fork download
  1. #define C(x)*c-x?
  2. i,k,T,L,m;void f(char*c,char*t,char*l){while(L=l[i]){for(k=0;T=t[k];c++)L=C(49)C(43)C(92)C(85)C(41)C(33)C(38)C('|')C(94)T=48:(T^=L-48):(T|=L):(T&=L):(T^=1,L^1):(T=L):T:(m=T,T=L,m):L:(T=49),t[k++]=T;c++;l[i++]=L;}puts(t);puts(l);}
  3.  
  4. #include "stdio.h"
  5. int main() {
  6. char buf[1024],top[33],left[33];
  7. /* Copy and paste an example circuit as the first input,
  8.   and put a 'Q' immediately after it */
  9. scanf("%[^Q]Q ",buf);
  10. /* Then enter your top inputs */
  11. scanf("%[01]%*[^01]", top);
  12. /* Then your left ones */
  13. scanf("%[01]", left);
  14.  
  15. f(buf, top, left);
  16. /*
  17.   Output in the form:
  18.   BOTTOM
  19.   RIGHT
  20.   */
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0s 2056KB
stdin
UUUU))))
UU++)))&
UUU+)  U
UU++&))U
U++&+)^U
U)&\&)UU
   U+^UU
   \&UUUQ
11110000
00000000
stdout
00001001
11111111