#include #include typedef struct { int svetla, kde, vzd; } Stav; static int R,D,S; static int A[20][20]; static int B[20][20]; static Stav F[100000]; static int l,r; static int was[10000][30]; void f_init(void) {l=r=0;} void f_put(Stav x) { if (was[x.svetla][x.kde]) return; F[r++]=x; was[x.svetla][x.kde]=1; } Stav f_get(void) { return F[l++]; }; int f_empty(void) {return l>=r;} int is(int svetla, int kde) { return (1<