| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360233 | kawhiet | Dark Ride (EGOI25_darkride) | C++20 | 1 ms | 468 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
#ifdef LOCAL
vector<int> p(n);
for (int i = 0; i < n; i++) {
cin >> p[i];
}
#endif
auto ask = [&](int l, int r) {
string s(n, '0');
for (int i = l; i <= r; i++) {
s[i] = '1';
}
#ifdef LOCAL
string t(n, ' ');
for (int i = 0; i < n; i++) {
t[p[i]] = s[i];
}
int c = 0;
for (int i = 1; i < n; i++) {
c += t[i] != t[i - 1];
}
return c;
#endif
cout << "? " << s << endl;
int ret;
cin >> ret;
return ret;
};
vector<int> ans;
int l = n / 2 - 1, r = n;
while (l + 1 < r) {
int m = (l + r) / 2;
if (ask(0, m) % 2 == 0) {
r = m;
} else {
l = m;
}
}
ans.push_back(r);
l = 0, r = n / 2;
while (l + 1 < r) {
int m = (l + r) / 2;
if (ask(m, n - 1) % 2 == 0) {
l = m;
} else {
r = m;
}
}
ans.push_back(l);
assert(ans.size() == 2);
cout << "! " << ans[0] << ' ' << ans[1] << '\n';
return 0;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
