1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; const int N = 1e3 + 10; int n, m, s[N << 1]; int main () { FILE *in = fopen("alice.in", "r"); fscanf(in, "%d%d", &n ,&m); for (int i = 1; i <= n << 1; ++i) fscanf(in, "%1d", &s[i]); for (int i = 1; i <= n << 1; i += 3) { if (getchar() == '1') printf("%d", s[i]); if (getchar() == '1') printf("%d", s[i + 1]); printf("%d", s[i + 2]); fflush(stdout); } return 0; }
#include <cstdio> #include <vector> using namespace std; const int N = 1e3 + 10; vector <bool> ans; int n, m; bool p[N << 1]; int main () { FILE *in = fopen("bob.in", "r"), *out = fopen("bob.out", "w"); fscanf(in, "%d%d", &n, &m); for (int i = 1, t; i <= n; ++i) fscanf(in, "%d", &t), p[t] = true; for (int i = 1; i <= n << 1; i += 3) { printf("%d%d", p[i], p[i + 1]); fflush(stdout); if (p[i]) ans.push_back(getchar() - '0'); if (p[i + 1]) ans.push_back(getchar() - '0'); bool a = getchar() - '0'; if (p[i + 2]) ans.push_back(a); } for (bool i : ans) fprintf(out, "%d", i); return 0; }
|