voidsolve(){ int n; cin >> n; string s; cin >> s; int i = 0; int j = n - 1; int ans = 0; while (i < j) { if (s[i] != s[j]) { ans += 1; } i++; j--; } for (int i = 0; i <= n; i++) { if (i <= n - ans && i >= ans && ((i - ans) % 2 == 0 || n % 2 == 1)) { cout << 1; } else { cout << 0; } } cout << "\n"; }
voidsolve(){ int n; cin >> n; vi a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int l = 0; while (l < n && a[l] == l) { l += 1; } while (true) { cout << l << endl; int y; cin >> y; l = y; if (y == -1) { break; } } }
voidsolve(){ int n; cin >> n; int k; cin >> k; int i = 0; int ans = 0; while (i < n) { if (i % k == n % k) { ans ^= ask(i); i += k; } else { int r = n % k; ans ^= ask(i); ans ^= ask(i + r / 2); ans ^= ask(i + r); i += k + r; } } cout << "! " << ans << endl; }