QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#782642 | #9734. Identify Chord | tarjen | AC ✓ | 54ms | 3748kb | C++20 | 3.7kb | 2024-11-25 20:49:57 | 2024-12-08 23:00:04 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> p) {
out << "(" << p.first << "," << p.second << ")";
return out;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> v) {
out << "[";
if (!v.empty()) {
cout << v[0];
for (int i = 1; i < v.size(); i++) cout << "," << v[i];
}
out << "]";
return out;
}
#define int long long
const bool gen = false;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int rnd(int B = 2e9) { return (unsigned long long)rng() % B; }
struct Interator {
int n, sx, sy, query_cnt = 0;
int dis(int x, int y) { return min(abs(x - y), n - abs(x - y)); }
void init(int _n, int _sx = 0, int _sy = 0) {
n = _n;
query_cnt = 0;
if (!gen) return;
sx = _sx, sy = _sy;
while (dis(sx, sy) <= 1) {
sx = rnd() % n, sy = (sx + n / 2 + rnd() % max(10ll, n / 5)) % n;
}
cout << "n=" << n << " sx=" << sx << " sy=" << sy << endl;
}
int query(int x, int y) {
cout << "? " << x + 1 << " " << y + 1 << endl;
query_cnt++;
assert(query_cnt <= 40);
assert(dis(x, y) > 1);
if (gen) {
return min({dis(x, y), dis(x, sx) + dis(sy, y) + 1,
dis(x, sy) + dis(y, sx) + 1});
} else {
int z;
cin >> z;
return z;
}
}
void answer(int x, int y) {
cout << "! " << x + 1 << " " << y + 1 << endl;
if (gen) {
assert(sx ^ sy ^ x ^ y == 0);
} else {
int z;
cin >> z;
if (z != 1) exit(0);
}
}
} sol;
bool test = true;
void solve() {
int n;
if (!gen) {
cin >> n;
sol.init(n);
} else {
n = 1000000000;
// n = rnd() % 100 + 4;
sol.init(n, rnd() % n, rnd() % n);
}
auto dis = [&](int x, int y) { return min(abs(x - y), n - abs(x - y)); };
auto pre = [&](int x) { return (x - 1 + n) % n; };
auto nxt = [&](int x) { return (x + 1) % n; };
int x = rnd() % n, y = (x + n / 2) % n;
int nowd = sol.query(x, y);
int t = 0;
while (dis(x, y) == nowd) {
x = (x + n / 4) % n;
y = (y + n / 4) % n;
t++;
nowd = sol.query(x, y);
}
// if (test) cout << "getmain x=" << x << " y=" << y << endl;
if (nowd == 1) {
sol.answer(x, y);
return;
}
if (sol.query(pre(x), y) == nowd - 1) {
int l = 2, r = nowd - 1, res = 1;
while (l <= r) {
int mid = (l + r) / 2;
if (sol.query((x - mid + n) % n, y) == nowd - mid) {
res = mid;
l = mid + 1;
} else
r = mid - 1;
}
x = (x - res + n) % n;
nowd -= res;
} else if (sol.query(nxt(x), y) == nowd - 1) {
int l = 2, r = nowd - 1, res = 1;
while (l <= r) {
int mid = (l + r) / 2;
if (sol.query((x + mid) % n, y) == nowd - mid) {
res = mid;
l = mid + 1;
} else
r = mid - 1;
}
x = (x + res) % n;
nowd -= res;
}
if (nowd == 1) {
sol.answer(x, y);
return;
}
if (int z = sol.query(x, nxt(y)); z == nowd - 1) {
y = (y + nowd - 1) % n;
} else {
y = (y - nowd + 1 + n) % n;
}
sol.answer(x, y);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3612kb
input:
2 6 2 2 2 2 1 4 2 1 1
output:
? 2 5 ? 1 5 ? 3 5 ? 2 6 ! 2 4 ? 2 4 ? 3 1 ! 3 1
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 5ms
memory: 3620kb
input:
1000 15 6 5 5 6 4 1 19 6 7 5 5 4 3 1 17 8 2 3 3 1 1 15 6 7 5 4 4 5 1 14 5 6 6 6 1 15 3 4 2 3 1 1 17 6 5 3 4 4 1 20 6 5 3 4 2 1 13 2 3 3 3 1 18 5 4 6 5 5 1 13 3 4 2 1 1 14 7 2 3 3 1 1 17 4 5 3 4 4 1 12 5 4 3 3 3 1 10 3 2 3 1 1 14 6 5 3 3 2 1 19 8 7 4 2 3 1 1 19 9 3 4 2 3 3 1 12 4 3 2 3 3 1 20 9 8 5 7...
output:
? 9 1 ? 8 1 ? 6 1 ? 7 1 ? 8 2 ! 8 5 ? 10 19 ? 9 19 ? 11 19 ? 13 19 ? 12 19 ? 12 1 ! 12 3 ? 7 15 ? 11 2 ? 10 2 ? 12 2 ? 11 3 ! 11 3 ? 14 6 ? 13 6 ? 15 6 ? 2 6 ? 1 6 ? 1 7 ! 1 3 ? 2 9 ? 1 9 ? 3 9 ? 2 10 ! 2 5 ? 1 8 ? 15 8 ? 2 8 ? 3 8 ? 2 9 ! 2 9 ? 8 16 ? 7 16 ? 5 16 ? 4 16 ? 5 17 ! 5 14 ? 9 19 ? 8 19 ...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 13ms
memory: 3572kb
input:
1000 21 2 1 1 22 10 10 9 5 4 4 3 1 20 5 6 6 6 1 22 6 7 5 3 2 3 1 1 21 10 6 5 5 4 3 1 21 8 7 4 5 5 3 1 24 5 4 4 3 2 1 22 10 9 6 7 6 5 1 21 7 6 5 5 4 5 1 23 8 7 8 8 6 1 21 5 4 2 3 1 1 24 7 8 6 5 5 4 5 1 20 9 8 5 6 6 5 1 24 11 10 5 3 2 1 1 23 9 8 4 4 3 2 1 23 3 2 1 1 23 10 9 7 7 6 5 1 23 8 7 4 2 3 1 1 ...
output:
? 11 21 ? 10 21 ! 10 21 ? 11 22 ? 10 22 ? 12 22 ? 16 22 ? 18 22 ? 17 22 ? 17 1 ! 17 3 ? 5 15 ? 4 15 ? 6 15 ? 5 16 ! 5 11 ? 3 14 ? 2 14 ? 4 14 ? 6 14 ? 7 14 ? 8 14 ? 7 15 ! 7 15 ? 10 20 ? 15 4 ? 14 4 ? 12 4 ? 13 4 ? 13 5 ! 13 7 ? 2 12 ? 1 12 ? 19 12 ? 17 12 ? 18 12 ? 19 13 ! 19 15 ? 20 8 ? 19 8 ? 17 ...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 4ms
memory: 3620kb
input:
1000 25 12 8 9 7 4 6 5 5 1 25 10 11 9 5 5 4 3 1 25 12 5 6 4 2 3 3 1 25 12 5 6 4 4 3 4 1 26 12 11 6 3 3 2 1 26 7 6 9 7 5 1 26 11 12 10 5 5 4 5 1 27 12 13 11 6 3 3 4 1 25 12 8 9 7 6 6 5 6 1 27 9 10 8 4 6 5 5 1 27 11 10 7 8 7 6 5 1 27 10 11 9 7 7 6 5 1 26 5 4 6 5 3 1 25 10 9 8 7 8 6 1 27 8 7 10 8 8 1 2...
output:
? 16 3 ? 22 9 ? 21 9 ? 23 9 ? 1 9 ? 3 9 ? 2 9 ? 1 10 ! 1 6 ? 19 6 ? 18 6 ? 20 6 ? 24 6 ? 1 6 ? 25 6 ? 25 7 ! 25 9 ? 14 1 ? 20 7 ? 19 7 ? 21 7 ? 23 7 ? 24 7 ? 23 8 ! 23 6 ? 20 7 ? 1 13 ? 25 13 ? 2 13 ? 4 13 ? 3 13 ? 3 14 ! 3 11 ? 3 16 ? 2 16 ? 23 16 ? 20 16 ? 19 16 ? 20 17 ! 20 18 ? 7 20 ? 6 20 ? 3 2...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 9ms
memory: 3688kb
input:
1000 29 8 9 7 10 8 6 1 28 3 4 2 1 1 30 5 6 4 4 3 2 1 29 5 4 6 5 3 1 28 6 7 5 3 2 1 1 29 2 1 1 29 12 13 11 6 3 4 2 1 28 14 11 12 10 7 8 7 6 7 1 30 14 13 8 10 9 9 9 1 30 6 5 3 4 2 1 28 9 8 4 2 3 1 1 29 13 14 12 7 9 8 7 8 1 29 12 11 6 6 7 5 1 29 7 6 3 2 3 1 1 29 14 14 13 14 12 7 9 8 7 8 1 30 9 10 8 10 ...
output:
? 2 16 ? 1 16 ? 3 16 ? 6 16 ? 4 16 ? 3 17 ! 3 22 ? 22 8 ? 21 8 ? 23 8 ? 24 8 ! 24 8 ? 30 15 ? 29 15 ? 1 15 ? 3 15 ? 2 15 ? 2 16 ! 2 17 ? 14 28 ? 13 28 ? 11 28 ? 12 28 ? 13 29 ! 13 2 ? 9 23 ? 8 23 ? 10 23 ? 12 23 ? 13 23 ? 14 23 ! 14 23 ? 4 18 ? 3 18 ! 3 18 ? 11 25 ? 10 25 ? 12 25 ? 17 25 ? 20 25 ? 2...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 9ms
memory: 3520kb
input:
1000 32 13 12 6 3 2 3 1 1 30 14 14 13 7 4 2 1 1 32 2 3 1 1 31 14 13 7 6 6 5 6 1 32 7 8 6 3 4 2 1 32 10 9 5 3 4 4 1 31 9 10 8 10 10 9 9 1 31 5 6 6 6 1 32 12 13 13 13 1 30 14 13 7 4 2 2 1 1 31 13 12 9 9 10 10 1 31 12 13 11 9 12 12 10 1 33 9 8 12 10 9 9 1 32 5 6 4 4 3 2 1 32 4 3 2 3 3 1 32 8 9 7 4 4 3 ...
output:
? 20 4 ? 19 4 ? 13 4 ? 10 4 ? 9 4 ? 8 4 ? 9 5 ! 9 5 ? 13 28 ? 12 28 ? 14 28 ? 20 28 ? 23 28 ? 25 28 ? 26 28 ! 26 28 ? 25 9 ? 24 9 ? 26 9 ! 26 9 ? 24 8 ? 23 8 ? 17 8 ? 14 8 ? 16 8 ? 15 8 ? 15 9 ! 15 4 ? 17 1 ? 16 1 ? 18 1 ? 21 1 ? 22 1 ? 21 2 ! 21 3 ? 9 25 ? 8 25 ? 4 25 ? 2 25 ? 1 25 ? 2 26 ! 2 23 ? ...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 7ms
memory: 3684kb
input:
1000 34 10 9 5 3 2 3 1 1 33 14 13 10 12 12 11 12 1 33 14 15 13 7 4 4 3 2 1 34 11 10 11 8 9 9 1 34 11 12 10 11 12 11 9 1 35 14 15 13 10 12 12 11 12 1 34 12 13 11 6 7 5 6 4 1 34 12 11 11 9 10 10 1 34 16 16 16 15 1 33 8 9 7 4 6 5 5 1 33 15 16 14 8 11 10 11 12 1 34 16 15 8 5 6 5 4 1 33 13 14 12 9 12 11 ...
output:
? 13 30 ? 12 30 ? 8 30 ? 6 30 ? 5 30 ? 4 30 ? 5 31 ! 5 31 ? 9 25 ? 8 25 ? 2 25 ? 5 25 ? 7 25 ? 6 25 ? 6 26 ! 6 15 ? 13 29 ? 12 29 ? 14 29 ? 20 29 ? 23 29 ? 25 29 ? 24 29 ? 24 30 ! 24 31 ? 1 18 ? 34 18 ? 29 18 ? 32 18 ? 31 18 ? 32 19 ! 32 11 ? 1 18 ? 34 18 ? 2 18 ? 7 18 ? 4 18 ? 3 18 ? 2 19 ! 2 27 ? ...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 8ms
memory: 3688kb
input:
1000 36 17 16 8 5 7 8 7 1 36 17 16 9 12 10 10 10 1 36 13 14 12 11 14 13 13 1 36 7 6 9 7 7 1 36 11 12 10 5 3 2 3 1 1 36 16 15 8 6 6 5 6 1 35 13 12 6 3 4 2 1 36 17 16 9 13 14 13 13 1 36 14 13 11 10 9 10 10 1 36 16 17 15 10 12 12 11 12 1 36 18 1 1 36 2 3 1 1 36 17 17 16 8 4 2 1 1 36 15 16 14 10 11 12 1...
output:
? 29 11 ? 28 11 ? 20 11 ? 16 11 ? 18 11 ? 19 11 ? 20 12 ! 20 18 ? 26 8 ? 25 8 ? 17 8 ? 21 8 ? 19 8 ? 18 8 ? 19 9 ! 19 35 ? 3 21 ? 2 21 ? 4 21 ? 10 21 ? 7 21 ? 5 21 ? 4 22 ! 4 10 ? 4 22 ? 3 22 ? 36 22 ? 2 22 ? 3 23 ! 3 17 ? 23 5 ? 22 5 ? 24 5 ? 29 5 ? 31 5 ? 32 5 ? 33 5 ? 32 6 ! 32 6 ? 32 14 ? 31 14 ...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
1000 37 7 6 5 5 4 3 1 36 17 17 16 9 13 15 15 16 1 38 19 9 8 8 6 7 5 1 37 14 15 13 11 14 14 12 1 37 15 16 14 7 4 4 3 2 1 36 12 11 12 11 10 11 1 37 14 15 13 11 10 11 9 1 37 14 13 9 10 9 8 9 1 37 16 17 15 10 12 10 11 11 1 37 8 7 8 6 7 7 1 37 9 10 10 10 1 37 17 18 16 9 12 11 11 12 1 36 5 6 4 2 3 1 1 37 ...
output:
? 30 11 ? 29 11 ? 26 11 ? 28 11 ? 27 11 ? 27 12 ! 27 14 ? 24 6 ? 23 6 ? 25 6 ? 33 6 ? 29 6 ? 27 6 ? 26 6 ? 26 7 ! 26 28 ? 12 31 ? 21 2 ? 20 2 ? 16 2 ? 18 2 ? 17 2 ? 18 3 ! 18 7 ? 20 1 ? 19 1 ? 21 1 ? 27 1 ? 24 1 ? 22 1 ? 21 2 ! 21 13 ? 7 25 ? 6 25 ? 8 25 ? 15 25 ? 18 25 ? 20 25 ? 19 25 ? 19 26 ! 19 ...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 10ms
memory: 3576kb
input:
1000 39 15 16 14 11 13 13 12 11 1 38 8 9 7 4 6 5 5 1 38 15 14 7 4 6 5 5 1 39 12 13 11 6 9 7 7 1 38 15 14 11 13 13 12 11 1 39 6 5 3 2 3 3 1 39 15 14 12 11 13 12 10 1 38 18 17 9 6 7 6 5 1 39 14 13 13 10 11 9 1 39 11 12 10 5 7 6 6 1 39 11 12 10 11 8 9 7 1 38 18 17 10 14 16 16 15 1 39 19 10 11 9 5 5 4 5...
output:
? 22 2 ? 21 2 ? 23 2 ? 30 2 ? 26 2 ? 24 2 ? 25 2 ? 25 3 ! 25 13 ? 17 36 ? 16 36 ? 18 36 ? 21 36 ? 23 36 ? 22 36 ? 21 37 ! 21 33 ? 37 18 ? 36 18 ? 29 18 ? 26 18 ? 24 18 ? 25 18 ? 26 19 ! 26 15 ? 35 15 ? 34 15 ? 36 15 ? 2 15 ? 5 15 ? 3 15 ? 2 16 ! 2 10 ? 29 10 ? 28 10 ? 21 10 ? 25 10 ? 27 10 ? 26 10 ?...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 9ms
memory: 3688kb
input:
1000 40 8 9 7 6 6 5 4 1 40 6 7 7 5 1 40 19 18 10 15 16 15 15 1 40 8 7 4 2 1 1 40 16 17 15 8 6 6 5 6 1 40 19 19 18 9 6 8 9 8 1 41 14 13 9 10 9 8 7 1 40 9 10 8 4 2 3 1 1 40 20 18 17 9 7 9 10 8 1 40 20 6 7 5 3 4 4 1 40 12 11 10 9 8 9 9 1 41 9 10 8 4 4 3 2 1 40 7 8 6 7 5 6 4 1 40 4 5 3 2 3 3 1 40 15 16 ...
output:
? 23 3 ? 22 3 ? 24 3 ? 27 3 ? 25 3 ? 26 3 ? 26 4 ! 26 7 ? 27 7 ? 26 7 ? 28 7 ? 27 8 ! 27 12 ? 37 17 ? 36 17 ? 27 17 ? 32 17 ? 34 17 ? 33 17 ? 33 18 ! 33 3 ? 21 1 ? 20 1 ? 17 1 ? 15 1 ? 14 1 ! 14 1 ? 12 32 ? 11 32 ? 13 32 ? 20 32 ? 24 32 ? 22 32 ? 23 32 ? 23 33 ! 23 28 ? 5 25 ? 4 25 ? 6 25 ? 15 25 ? ...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1000 42 13 12 14 15 13 13 1 41 17 16 12 16 18 17 15 1 41 19 18 9 7 9 8 9 1 41 7 8 6 5 5 4 3 1 41 8 9 7 4 4 3 4 1 41 8 9 7 10 8 8 1 41 13 14 12 6 5 5 4 5 1 41 7 8 6 5 5 4 3 1 41 19 18 11 14 14 15 15 1 41 14 15 13 13 14 12 13 13 1 41 15 16 14 9 11 9 8 7 1 42 20 20 19 11 15 13 13 14 1 41 14 15 13 13 12...
output:
? 7 28 ? 6 28 ? 42 28 ? 3 28 ? 5 28 ? 6 29 ! 6 17 ? 39 18 ? 38 18 ? 30 18 ? 34 18 ? 36 18 ? 37 18 ? 38 19 ! 38 33 ? 27 6 ? 26 6 ? 17 6 ? 13 6 ? 15 6 ? 16 6 ? 16 7 ! 16 40 ? 13 33 ? 12 33 ? 14 33 ? 17 33 ? 15 33 ? 16 33 ? 16 34 ! 16 36 ? 5 25 ? 4 25 ? 6 25 ? 9 25 ? 11 25 ? 10 25 ? 10 26 ! 10 23 ? 36 ...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 14ms
memory: 3744kb
input:
1000 43 18 17 13 13 11 12 12 1 42 18 19 17 9 8 10 10 10 1 43 19 20 18 11 14 14 13 12 1 43 19 18 11 14 12 11 10 11 1 43 15 14 14 13 13 12 11 1 43 20 19 10 7 8 7 8 8 1 43 19 18 9 8 7 8 6 1 43 21 21 21 20 21 19 10 6 9 9 10 1 42 13 14 12 14 11 11 10 11 1 42 20 20 19 11 16 18 18 19 1 42 17 18 16 10 12 10...
output:
? 10 31 ? 9 31 ? 1 31 ? 5 31 ? 3 31 ? 2 31 ? 3 32 ! 3 21 ? 7 28 ? 6 28 ? 8 28 ? 16 28 ? 20 28 ? 18 28 ? 17 28 ? 16 29 ! 16 20 ? 15 36 ? 14 36 ? 16 36 ? 25 36 ? 20 36 ? 22 36 ? 21 36 ? 21 37 ! 21 5 ? 23 1 ? 22 1 ? 13 1 ? 18 1 ? 16 1 ? 15 1 ? 14 1 ? 14 2 ! 14 35 ? 8 29 ? 7 29 ? 43 29 ? 4 29 ? 6 29 ? 5...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 9ms
memory: 3576kb
input:
1000 44 14 15 15 13 1 44 19 20 18 9 8 10 10 8 1 43 14 13 15 14 12 13 13 1 43 12 13 11 6 5 5 4 5 1 44 17 18 16 13 12 14 13 13 1 44 22 16 15 8 10 10 9 7 1 44 13 12 12 9 10 8 1 44 6 7 5 7 6 6 1 43 9 8 8 6 7 5 1 43 11 10 9 8 7 8 8 1 44 22 9 8 6 6 5 4 1 44 20 19 12 17 19 20 18 1 44 5 6 4 4 3 2 1 44 21 21...
output:
? 6 28 ? 5 28 ? 7 28 ? 6 29 ! 6 41 ? 19 41 ? 18 41 ? 20 41 ? 29 41 ? 33 41 ? 31 41 ? 30 41 ? 29 42 ! 29 5 ? 26 4 ? 25 4 ? 19 4 ? 22 4 ? 24 4 ? 23 4 ? 24 5 ! 24 36 ? 10 31 ? 9 31 ? 11 31 ? 16 31 ? 19 31 ? 17 31 ? 18 31 ? 18 32 ! 18 28 ? 35 13 ? 34 13 ? 36 13 ? 44 13 ? 40 13 ? 42 13 ? 41 13 ? 40 14 ! ...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 12ms
memory: 3624kb
input:
1000 45 19 18 9 9 11 10 8 1 45 22 9 8 8 6 7 5 1 45 10 11 9 5 3 2 1 1 45 16 17 15 8 10 8 7 6 1 45 17 16 14 16 14 15 15 1 45 17 18 16 10 12 10 9 8 1 45 19 18 13 14 12 13 11 1 45 7 6 3 4 4 1 44 19 18 9 8 7 8 6 1 45 13 14 12 6 3 2 3 1 1 44 20 21 19 12 15 15 16 16 1 45 18 17 9 5 3 2 3 3 1 44 16 15 14 14 ...
output:
? 15 37 ? 14 37 ? 5 37 ? 1 37 ? 3 37 ? 4 37 ? 5 38 ! 5 45 ? 4 26 ? 15 37 ? 14 37 ? 10 37 ? 12 37 ? 11 37 ? 12 38 ! 12 42 ? 41 18 ? 40 18 ? 42 18 ? 1 18 ? 3 18 ? 4 18 ? 5 18 ! 5 18 ? 23 45 ? 22 45 ? 24 45 ? 31 45 ? 35 45 ? 33 45 ? 32 45 ? 32 1 ! 32 6 ? 5 27 ? 4 27 ? 41 27 ? 45 27 ? 2 27 ? 1 27 ? 2 28...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 18ms
memory: 3688kb
input:
1000 46 16 15 12 12 10 11 11 1 46 13 12 10 9 8 9 9 1 46 14 15 13 16 14 12 13 11 1 46 19 20 18 13 14 12 13 13 1 46 11 12 10 11 8 9 7 1 46 9 10 8 4 2 3 1 1 46 16 17 15 8 8 6 7 5 1 46 8 9 9 9 1 46 22 22 21 11 7 9 8 8 9 1 46 11 10 5 7 6 6 1 45 22 18 19 17 11 13 11 10 11 1 46 6 7 5 5 4 5 1 46 22 22 21 12...
output:
? 17 40 ? 16 40 ? 9 40 ? 13 40 ? 11 40 ? 10 40 ? 11 41 ! 11 31 ? 34 11 ? 33 11 ? 27 11 ? 30 11 ? 29 11 ? 28 11 ? 29 12 ! 29 4 ? 5 28 ? 4 28 ? 6 28 ? 12 28 ? 9 28 ? 7 28 ? 8 28 ? 7 29 ! 7 39 ? 45 22 ? 44 22 ? 46 22 ? 9 22 ? 4 22 ? 6 22 ? 7 22 ? 6 23 ! 6 11 ? 17 40 ? 16 40 ? 18 40 ? 23 40 ? 20 40 ? 21...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 43ms
memory: 3648kb
input:
1000 1000000000 499999999 499999998 250000000 375000000 437500000 468749999 453124999 445312499 441406250 443359375 444335937 443847657 444091798 444213867 444152833 444183350 444168092 444175722 444179536 444177630 444178583 444178106 444177869 444177988 444178048 444178078 444178093 444178100 4441...
output:
? 927869275 427869275 ? 927869274 427869275 ? 677869275 427869275 ? 802869275 427869275 ? 865369275 427869275 ? 896619275 427869275 ? 880994275 427869275 ? 873181775 427869275 ? 869275525 427869275 ? 871228650 427869275 ? 872205213 427869275 ? 871716932 427869275 ? 871961073 427869275 ? 872083143 42...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 46ms
memory: 3508kb
input:
1000 1000000000 499999969 499999968 249999984 124999992 62499996 31250029 46874997 39062529 42968779 44921904 45898435 45410154 45166014 45043944 44982940 45013427 44998168 44990539 44986755 44988663 44989617 44990063 44989825 44989737 44989788 44989796 44989781 44989780 44989778 44989778 44989777 4...
output:
? 858261097 358261097 ? 858261096 358261097 ? 608261112 358261097 ? 483261120 358261097 ? 420761124 358261097 ? 389511126 358261097 ? 405136125 358261097 ? 397323626 358261097 ? 401229876 358261097 ? 403183001 358261097 ? 404159563 358261097 ? 403671282 358261097 ? 403427142 358261097 ? 403305072 35...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 32ms
memory: 3748kb
input:
1000 1000000000 388432031 388432032 388432030 194216017 291324023 242770019 218493017 206354516 200285266 197250641 195733328 194974672 194595344 194405680 194310848 194263432 194239724 194227870 194221943 194218979 194217497 194216756 194216386 194216201 194216108 194216062 194216039 194216027 1942...
output:
? 542858081 42858081 ? 542858080 42858081 ? 542858082 42858081 ? 737074097 42858081 ? 639966089 42858081 ? 688520093 42858081 ? 712797095 42858081 ? 724935596 42858081 ? 731004846 42858081 ? 734039471 42858081 ? 735556784 42858081 ? 736315440 42858081 ? 736694768 42858081 ? 736884432 42858081 ? 7369...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 47ms
memory: 3688kb
input:
1000 1000000000 302230378 302230379 302230377 151115189 226672713 188893916 170004517 160559818 155837468 153476293 152295706 151705412 151410265 151262692 151188905 151152012 151133565 151124342 151119730 151117424 151116271 151115695 151115407 151115263 151115191 151115155 151115171 151115162 1511...
output:
? 233642122 733642122 ? 233642121 733642122 ? 233642123 733642122 ? 384757311 733642122 ? 460314905 733642122 ? 422536108 733642122 ? 403646709 733642122 ? 394202010 733642122 ? 389479660 733642122 ? 387118485 733642122 ? 385937898 733642122 ? 385347604 733642122 ? 385052457 733642122 ? 384904884 73...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 36ms
memory: 3644kb
input:
1000 1000000000 458912845 458912844 229456422 114728211 98451261 86046159 99116809 91946296 88361039 86568411 85672097 85598002 85448018 85485963 85429944 85420008 85415939 85413005 85412438 85411254 85411563 85411126 85411035 85411017 85410980 85410990 85410976 85410973 85410973 85410971 85410972 8...
output:
? 331629825 831629825 ? 331629824 831629825 ? 102173402 831629825 ? 987445191 831629825 ? 930081086 831629825 ? 958763139 831629825 ? 944422113 831629825 ? 951592626 831629825 ? 955177883 831629825 ? 956970511 831629825 ? 957866825 831629825 ? 958314982 831629825 ? 958090904 831629825 ? 958202943 83...
result:
ok ok (1000 test cases)
Test #22:
score: 0
Accepted
time: 23ms
memory: 3580kb
input:
1000 999999999 499999999 499999998 499999999 499999997 249999999 125000001 187500000 156250001 171875001 179687501 183593750 181640626 182617189 183105469 182861329 182739259 182678224 182647706 182632447 182624818 182621004 182622912 182623865 182623389 182623627 182623509 182623569 182623599 18262...
output:
? 651242148 151242148 ? 901242147 401242147 ? 901242146 401242147 ? 901242148 401242147 ? 151242147 401242147 ? 276242146 401242147 ? 213742146 401242147 ? 244992146 401242147 ? 229367146 401242147 ? 221554646 401242147 ? 217648396 401242147 ? 219601521 401242147 ? 218624958 401242147 ? 218136677 40...
result:
ok ok (1000 test cases)
Test #23:
score: 0
Accepted
time: 42ms
memory: 3744kb
input:
1000 999999999 499999956 499999957 499999955 250000021 374999967 312499973 281249976 265625020 273437477 269531227 267578145 268554665 268066384 267822243 267700173 267639181 267669656 267654440 267662027 267658255 267660163 267661074 267660597 267660359 267660242 267660300 267660270 267660255 26766...
output:
? 455836423 955836422 ? 455836422 955836422 ? 455836424 955836422 ? 705836401 955836422 ? 580836412 955836422 ? 643336406 955836422 ? 674586403 955836422 ? 690211402 955836422 ? 682398902 955836422 ? 686305152 955836422 ? 688258277 955836422 ? 687281714 955836422 ? 687769995 955836422 ? 688014136 95...
result:
ok ok (1000 test cases)
Test #24:
score: 0
Accepted
time: 54ms
memory: 3624kb
input:
1000 999999999 384697070 384697069 192348535 211477198 240435668 216392101 204370318 198359426 195353980 193851257 193099896 192724215 192536375 192442455 192395495 192372015 192360275 192354405 192351470 192350002 192349268 192348901 192348718 192348626 192348580 192348557 192348546 192348540 19234...
output:
? 854621507 354621507 ? 854621506 354621507 ? 662272972 354621507 ? 566098705 354621507 ? 614185839 354621507 ? 638229406 354621507 ? 650251189 354621507 ? 656262081 354621507 ? 659267527 354621507 ? 660770250 354621507 ? 661521611 354621507 ? 661897292 354621507 ? 662085132 354621507 ? 662179052 35...
result:
ok ok (1000 test cases)
Test #25:
score: 0
Accepted
time: 38ms
memory: 3632kb
input:
1000 999999999 189850107 189850106 94925053 142387515 118656252 106790620 100857804 97891396 96408192 95666590 95295789 95110389 95017689 94971339 94948164 94936576 94930782 94927885 94926437 94925713 94925351 94925170 94925079 94925034 94925031 94925022 94925026 94925023 94925022 94925021 94925022 ...
output:
? 851417512 351417512 ? 851417511 351417512 ? 756492458 351417512 ? 709029932 351417512 ? 732761195 351417512 ? 744626827 351417512 ? 750559643 351417512 ? 753526051 351417512 ? 755009255 351417512 ? 755750857 351417512 ? 756121658 351417512 ? 756307058 351417512 ? 756399758 351417512 ? 756446108 35...
result:
ok ok (1000 test cases)
Test #26:
score: 0
Accepted
time: 43ms
memory: 3660kb
input:
1000 999999999 249264885 249264884 124632442 62316221 54337555 46737166 46548027 42842403 44600645 43626954 43140108 42896685 42774974 42781548 42751120 42759760 42752153 42748349 42749219 42748268 42747873 42748031 42747912 42747853 42747843 42747838 42747835 42747835 42747833 42747834 42747832 1 9...
output:
? 214527175 714527174 ? 214527174 714527174 ? 89894732 714527174 ? 27578511 714527174 ? 996420400 714527174 ? 11999456 714527174 ? 4209929 714527174 ? 8104693 714527174 ? 6157311 714527174 ? 7131002 714527174 ? 7617848 714527174 ? 7861271 714527174 ? 7982982 714527174 ? 8043838 714527174 ? 8013410 7...
result:
ok ok (1000 test cases)
Test #27:
score: 0
Accepted
time: 24ms
memory: 3660kb
input:
1000 536870912 108355805 108355806 108355804 54177902 61443339 47898863 47405665 44512744 45712606 44866076 44442811 44301111 44336995 44284087 44274657 44270860 44268043 44267554 44266389 44266728 44266315 44266182 44266212 44266160 44266156 44266147 44266149 44266146 44266146 44266145 44266146 1 5...
output:
? 127713065 396148521 ? 127713064 396148521 ? 127713066 396148521 ? 181890968 396148521 ? 208979919 396148521 ? 195435443 396148521 ? 188663205 396148521 ? 192049324 396148521 ? 190356264 396148521 ? 191202794 396148521 ? 191626059 396148521 ? 191837691 396148521 ? 191731875 396148521 ? 191784783 39...
result:
ok ok (1000 test cases)
Test #28:
score: 0
Accepted
time: 38ms
memory: 3664kb
input:
1000 536870911 244408484 244408485 244408483 122204242 85129092 115680153 107339086 114566477 110747595 108838154 107883433 107406073 107167393 107219745 107160075 107137558 107145157 107137698 107133969 107135694 107134762 107134296 107134063 107133946 107133910 107133917 107133903 107133902 107133...
output:
? 311189382 42753926 ? 311189381 42753926 ? 311189383 42753926 ? 433393624 42753926 ? 494495745 42753926 ? 463944684 42753926 ? 448669154 42753926 ? 441031389 42753926 ? 444850271 42753926 ? 446759712 42753926 ? 447714433 42753926 ? 448191793 42753926 ? 448430473 42753926 ? 448549813 42753926 ? 4484...
result:
ok ok (1000 test cases)
Extra Test:
score: 0
Extra Test Passed