QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#857241 | #9734. Identify Chord | ucup-team045 | AC ✓ | 53ms | 3712kb | C++20 | 3.6kb | 2025-01-15 13:28:57 | 2025-01-15 13:28:57 |
Judging History
answer
#include<iostream>
#include<cstring>
#include<vector>
#include<cassert>
#include<algorithm>
using namespace std;
using LL = long long;
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int T;
cin >> T;
while(T--){
int n;
cin >> n;
auto dis = [&](int a, int b){
int d = (b - a + n) % n;
d = min(d, n - d);
return d;
};
int p[2];
p[0] = rand() % n;
p[1] = rand() % n;
while(dis(p[0], p[1]) <= 1){
p[1] = rand() % n;
}
auto ask = [&](int x, int y){
cout << "? " << x + 1 << ' ' << y + 1 << endl;
#ifdef LOCAL
int ans = dis(x, y);
for(int i = 0; i < 2; i++){
for(int j = 0; j < 2; j++){
ans = min(ans, 1 + dis(x, p[i]) + dis(y, p[j]));
}
}
return ans;
#endif
int t;
cin >> t;
return t;
};
if (n <= 10){
bool ok = false;
for(int i = 0; i < n and !ok; i++){
for(int j = i + 1; j < n and !ok; j++){
if (dis(i, j) != 1 and ask(i, j) == 1){
ok = true;
cout << "! " << i + 1 << ' ' << j + 1 << endl;
#ifdef LOCAL
assert(minmax(i, j) == minmax(p[0], p[1]));
#endif
}
}
}
int t;
cin >> t;
continue;
}
int best = 1e9;
int p1 = -1, p2 = -1;
for(int i = 0, st = 0; i < 4; i++, st += n / 8){
int t = ask(st, st + n / 2);
if (t < best){
best = t;
p1 = st;
p2 = st + n / 2;
}
}
for(int i = 0, st = 0; i < 4; i++, st += n / 8){
int t = ask(st, st + (n + 1) / 2);
if (t < best){
best = t;
p1 = st;
p2 = st + (n + 1) / 2;
}
}
int ans1 = -1, ans2 = -1;
if (ask((p1 + 1) % n, p2) == best - 1){
int l = 0, r = best - 1;
while(l < r){
int mid = (l + r + 1) / 2;
if (ask((p1 + mid) % n, p2) == best - mid) l = mid;
else r = mid - 1;
}
ans1 = (p1 + r) % n;
}
else{
int l = 0, r = best - 1;
while(l < r){
int mid = (l + r + 1) / 2;
if (ask((p1 - mid + n) % n, p2) == best - mid) l = mid;
else r = mid - 1;
}
ans1 = (p1 - r + n) % n;
}
int d = dis(ans1, p1);
int remain = best - d - 1;
int cand1 = (p2 - remain + n) % n;
int cand2 = (p2 + remain) % n;
if (dis(ans1, cand1) > 1 and ask(ans1, cand1) == 1){
ans2 = cand1;
}
else{
ans2 = cand2;
}
cout << "! " << ans1 + 1 << ' ' << ans2 + 1 << endl;
// if (minmax(ans1, ans2) != minmax(p[0], p[1])){
// cout << n << ' ' << p[0] << ' ' << p[1] << '\n';
// return 0;
// }
#ifdef LOCAL
assert(minmax(ans1, ans2) == minmax(p[0], p[1]));
#endif
int t;
cin >> t;
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
input:
2 6 2 2 2 1 1 4 1 1
output:
? 1 3 ? 1 4 ? 1 5 ? 2 4 ! 2 4 ? 1 3 ! 1 3
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 16ms
memory: 3712kb
input:
1000 15 5 5 5 5 6 6 6 6 4 3 2 1 1 1 19 5 1 5 9 4 2 6 9 2 1 1 17 5 1 5 8 4 2 6 8 2 1 1 15 6 7 7 7 7 7 6 6 6 5 7 1 1 14 5 5 7 7 5 5 7 7 4 5 4 1 1 15 3 1 3 5 2 2 4 6 2 1 1 17 8 6 2 4 8 5 1 5 2 1 1 20 6 10 8 6 6 10 8 6 7 7 7 1 1 13 5 6 6 4 6 6 5 3 2 2 1 1 1 18 3 5 9 7 3 5 9 7 4 2 3 3 1 13 4 4 4 6 3 3 5 ...
output:
? 1 8 ? 2 9 ? 3 10 ? 4 11 ? 1 9 ? 2 10 ? 3 11 ? 4 12 ? 2 8 ? 3 8 ? 4 8 ? 5 8 ? 5 8 ! 5 8 ? 1 10 ? 3 12 ? 5 14 ? 7 16 ? 1 11 ? 3 13 ? 5 15 ? 7 17 ? 4 12 ? 3 12 ! 3 12 ? 1 9 ? 3 11 ? 5 13 ? 7 15 ? 1 10 ? 3 12 ? 5 14 ? 7 16 ? 4 11 ? 3 11 ! 3 11 ? 1 8 ? 2 9 ? 3 10 ? 4 11 ? 1 9 ? 2 10 ? 3 11 ? 4 12 ? 2 8...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 9ms
memory: 3456kb
input:
1000 21 3 7 10 8 4 8 10 7 4 2 3 1 1 22 8 4 4 6 8 4 4 6 5 6 5 7 1 20 5 5 5 9 5 5 5 9 4 3 2 1 1 1 22 10 6 4 4 10 6 4 4 3 2 3 1 1 21 9 5 5 5 8 6 6 6 4 3 2 1 1 1 21 8 8 8 10 7 7 9 10 8 4 5 5 7 1 24 11 9 5 5 11 9 5 5 4 3 2 3 1 1 22 10 11 10 10 10 11 10 10 10 5 3 2 2 3 1 21 4 2 6 10 3 3 7 10 3 1 1 1 23 8 ...
output:
? 1 11 ? 3 13 ? 5 15 ? 7 17 ? 1 12 ? 3 14 ? 5 16 ? 7 18 ? 2 11 ? 21 11 ? 20 11 ? 21 10 ! 21 10 ? 1 12 ? 3 14 ? 5 16 ? 7 18 ? 1 12 ? 3 14 ? 5 16 ? 7 18 ? 4 14 ? 1 14 ? 2 14 ? 3 11 ! 3 17 ? 1 11 ? 3 13 ? 5 15 ? 7 17 ? 1 11 ? 3 13 ? 5 15 ? 7 17 ? 2 11 ? 3 11 ? 4 11 ? 5 11 ? 5 11 ! 5 11 ? 1 12 ? 3 14 ? ...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 25 8 12 9 9 9 12 8 8 9 9 10 9 1 1 25 6 12 9 5 7 12 8 4 5 4 3 5 1 25 11 10 6 6 12 9 5 5 6 5 4 7 1 25 5 7 12 8 6 8 12 7 4 3 4 1 1 26 12 12 12 12 12 12 12 12 12 6 4 5 5 9 1 26 11 11 7 7 11 11 7 7 8 8 6 7 9 1 26 13 11 11 11 13 11 11 11 12 8 11 10 5 1 27 12 12 12 13 13 13 13 12 11 6 4 5 5 1 1 25 9 1...
output:
? 1 13 ? 4 16 ? 7 19 ? 10 22 ? 1 14 ? 4 17 ? 7 20 ? 10 23 ? 2 13 ? 22 13 ? 24 13 ? 25 13 ? 1 6 ! 1 6 ? 1 13 ? 4 16 ? 7 19 ? 10 22 ? 1 14 ? 4 17 ? 7 20 ? 10 23 ? 11 23 ? 8 23 ? 9 23 ? 9 21 ! 9 25 ? 1 13 ? 4 16 ? 7 19 ? 10 22 ? 1 14 ? 4 17 ? 7 20 ? 10 23 ? 8 20 ? 5 20 ? 6 20 ? 6 17 ! 6 23 ? 1 13 ? 4 1...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 15ms
memory: 3584kb
input:
1000 29 10 6 6 10 9 5 5 11 6 5 4 7 1 28 13 11 5 3 13 11 5 3 4 2 1 1 1 30 3 5 11 15 3 5 11 15 2 2 3 3 1 29 4 8 14 11 5 9 14 10 3 4 3 1 1 28 8 14 10 6 8 14 10 6 5 3 2 3 1 1 29 6 2 8 14 5 3 9 14 3 1 1 1 29 9 9 11 14 8 8 12 13 9 6 6 5 9 1 28 11 11 11 14 11 11 11 14 10 6 5 5 4 1 1 30 4 10 15 10 4 10 15 1...
output:
? 1 15 ? 4 18 ? 7 21 ? 10 24 ? 1 16 ? 4 19 ? 7 22 ? 10 25 ? 5 19 ? 2 19 ? 3 19 ? 3 16 ! 3 22 ? 1 15 ? 4 18 ? 7 21 ? 10 24 ? 1 15 ? 4 18 ? 7 21 ? 10 24 ? 11 24 ? 9 24 ? 8 24 ? 8 24 ! 8 24 ? 1 16 ? 4 19 ? 7 22 ? 10 25 ? 1 16 ? 4 19 ? 7 22 ? 10 25 ? 2 16 ? 2 16 ? 3 16 ? 2 15 ! 2 17 ? 1 15 ? 4 18 ? 7 21...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 16ms
memory: 3712kb
input:
1000 32 13 13 13 13 13 13 13 13 12 10 10 9 10 1 1 30 14 14 14 14 14 14 14 14 14 8 11 10 11 8 1 32 16 10 2 8 16 10 2 8 3 3 3 1 31 5 5 11 15 6 6 12 15 4 3 2 3 1 1 32 7 3 11 15 7 3 11 15 4 2 1 1 1 32 8 6 10 16 8 6 10 16 7 3 4 5 1 31 15 9 9 9 14 10 10 10 8 5 3 2 1 1 1 31 6 6 10 15 5 5 11 15 6 5 4 7 1 32...
output:
? 1 17 ? 5 21 ? 9 25 ? 13 29 ? 1 17 ? 5 21 ? 9 25 ? 13 29 ? 2 17 ? 7 17 ? 4 17 ? 5 17 ? 6 17 ? 5 9 ! 5 9 ? 1 16 ? 4 19 ? 7 22 ? 10 25 ? 1 16 ? 4 19 ? 7 22 ? 10 25 ? 2 16 ? 24 16 ? 28 16 ? 26 16 ? 27 16 ? 28 6 ! 28 26 ? 1 17 ? 5 21 ? 9 25 ? 13 29 ? 1 17 ? 5 21 ? 9 25 ? 13 29 ? 10 25 ? 8 25 ? 9 24 ! 9...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 34 17 10 10 10 17 10 10 10 11 12 12 11 8 1 33 8 8 14 13 9 9 15 12 7 4 4 3 1 1 33 11 11 13 14 10 10 14 13 11 9 8 7 8 13 1 34 11 17 9 5 11 17 9 5 6 3 4 5 1 34 11 9 9 15 11 9 9 15 10 7 7 6 11 1 35 14 15 15 15 15 14 14 14 15 11 15 15 1 1 34 8 16 12 4 8 16 12 4 5 6 5 7 1 34 14 6 6 12 14 6 6 12 7 9 7...
output:
? 1 18 ? 5 22 ? 9 26 ? 13 30 ? 1 18 ? 5 22 ? 9 26 ? 13 30 ? 6 22 ? 34 22 ? 3 22 ? 4 22 ? 5 13 ! 5 31 ? 1 17 ? 5 21 ? 9 25 ? 13 29 ? 1 18 ? 5 22 ? 9 26 ? 13 30 ? 2 17 ? 5 17 ? 7 17 ? 6 17 ? 6 15 ! 6 15 ? 1 17 ? 5 21 ? 9 25 ? 13 29 ? 1 18 ? 5 22 ? 9 26 ? 13 30 ? 2 18 ? 29 18 ? 32 18 ? 31 18 ? 30 18 ? ...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 12ms
memory: 3712kb
input:
1000 36 18 17 17 17 18 17 17 17 16 9 5 4 4 1 1 36 3 11 18 11 3 11 18 11 4 2 1 1 1 36 13 15 15 13 13 15 15 13 12 12 10 11 1 1 36 5 9 17 13 5 9 17 13 4 3 4 1 1 36 18 11 9 9 18 11 9 9 10 7 7 6 11 1 36 12 8 8 14 12 8 8 14 7 4 4 3 1 1 35 13 13 16 12 12 14 15 13 11 6 3 4 1 1 36 13 9 9 13 13 9 9 13 8 5 3 4...
output:
? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 6 23 ? 13 23 ? 17 23 ? 19 23 ? 18 23 ? 18 20 ! 18 20 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 2 19 ? 36 19 ? 35 19 ? 35 19 ! 35 19 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 2 19 ? 7 19 ? 4 19 ? 5 19 ? 4 ...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 13ms
memory: 3584kb
input:
1000 37 17 14 6 6 18 13 7 7 5 3 2 1 1 1 36 17 17 18 17 17 17 18 17 17 9 6 8 8 15 1 38 9 9 13 19 9 9 13 19 8 5 3 4 1 1 37 15 11 11 11 14 12 12 12 10 6 3 4 1 1 37 12 18 11 11 13 18 12 12 10 6 3 2 1 1 1 36 8 8 16 14 8 8 16 14 9 6 6 5 9 1 37 6 8 16 15 5 9 17 14 6 3 4 5 1 37 18 13 5 5 18 12 4 6 3 4 3 5 1...
output:
? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 10 27 ? 12 27 ? 13 27 ? 14 27 ? 14 27 ! 14 27 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 1 19 ? 5 23 ? 9 27 ? 13 31 ? 2 19 ? 29 19 ? 25 19 ? 27 19 ? 28 19 ? 28 12 ! 28 26 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 2 20 ? 5 20 ? 7 20 ? ...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 20ms
memory: 3584kb
input:
1000 39 18 10 8 8 17 9 9 9 7 4 6 5 1 1 38 8 14 18 10 8 14 18 10 9 4 2 3 3 1 38 19 13 9 9 19 13 9 9 8 5 3 4 1 1 39 12 18 15 13 13 19 14 12 11 13 13 11 12 1 1 38 15 19 15 15 15 19 15 15 16 8 4 2 3 3 1 39 4 6 14 19 3 7 15 18 4 4 5 1 39 18 15 15 15 19 14 14 14 15 12 16 15 7 1 38 18 18 18 18 18 18 18 18 ...
output:
? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 1 21 ? 5 25 ? 9 29 ? 13 33 ? 10 28 ? 13 28 ? 15 28 ? 14 28 ? 13 25 ! 13 25 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 2 20 ? 35 20 ? 33 20 ? 32 20 ? 33 19 ! 33 21 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 1 20 ? 5 24 ? 9 28 ? 13 32 ? 10 28 ? 13 28 ? 15 28 ? 16 28...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 17ms
memory: 3712kb
input:
1000 40 12 2 10 20 12 2 10 20 1 1 1 1 40 18 8 6 14 18 8 6 14 5 7 5 6 1 1 40 15 11 11 17 15 11 11 17 12 10 9 8 9 15 1 40 8 18 14 8 8 18 14 8 9 12 10 9 1 1 40 16 20 16 16 16 20 16 16 17 8 4 4 3 5 1 40 15 17 7 5 15 17 7 5 6 5 4 1 1 41 13 20 14 14 14 19 13 13 14 15 16 14 1 1 40 7 11 20 11 7 11 20 11 8 4...
output:
? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 7 26 ? 7 26 ? 7 26 ! 7 26 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 12 31 ? 14 31 ? 12 31 ? 13 31 ? 12 27 ! 12 27 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 7 26 ? 1 26 ? 4 26 ? 3 26 ? 2 26 ? 3 19 ! ...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 20ms
memory: 3584kb
input:
1000 42 11 11 21 13 11 11 21 13 10 6 9 7 1 1 41 17 17 17 20 16 16 16 19 17 12 12 14 13 14 1 41 8 18 15 5 9 19 14 4 5 6 5 7 1 41 12 20 11 1 13 20 10 2 2 1 1 41 12 8 10 20 11 9 11 20 7 4 6 5 1 1 41 18 15 9 9 19 14 8 8 9 8 6 7 11 1 41 14 14 14 20 13 13 13 20 14 14 14 12 13 11 1 41 20 11 1 11 20 10 2 12...
output:
? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 2 22 ? 6 22 ? 9 22 ? 7 22 ? 6 17 ! 6 17 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 2 22 ? 34 22 ? 38 22 ? 36 22 ? 37 22 ? 38 11 ! 38 33 ? 1 21 ? 6 26 ? 11 31 ? 16 36 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 17 37 ? 14 37 ? 15 37...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 17ms
memory: 3712kb
input:
1000 43 4 10 20 15 5 11 21 14 3 2 3 1 1 42 18 18 18 18 18 18 18 18 17 9 5 3 4 1 1 43 6 8 18 17 7 9 19 16 5 3 2 3 1 1 43 18 17 7 5 19 16 6 6 6 3 4 1 1 43 21 15 15 15 21 14 14 14 15 14 15 13 14 11 1 43 17 18 8 8 18 17 7 7 8 10 8 13 1 43 18 21 19 19 19 20 18 18 17 12 17 16 17 1 1 43 21 21 21 21 21 20 2...
output:
? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 2 22 ? 3 22 ? 4 22 ? 3 21 ! 3 21 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 2 22 ? 10 22 ? 14 22 ? 16 22 ? 17 22 ? 16 20 ! 16 20 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 2 22 ? 4 22 ? 5 22 ? 6 22 ? ...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 16ms
memory: 3712kb
input:
1000 44 22 14 14 14 22 14 14 14 15 15 17 15 9 1 44 11 3 11 21 11 3 11 21 4 2 3 3 1 43 11 17 18 10 10 18 17 11 9 5 3 2 3 1 1 43 21 14 12 12 21 13 13 13 11 6 7 5 6 1 1 44 19 17 17 17 19 17 17 17 18 14 13 15 14 14 1 44 16 18 18 16 16 18 18 16 15 14 12 14 13 1 1 44 17 19 13 13 17 19 13 13 12 7 4 4 3 1 1...
output:
? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 7 28 ? 43 28 ? 3 28 ? 5 28 ? 6 15 ! 6 41 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 7 28 ? 5 28 ? 4 28 ? 5 27 ! 5 29 ? 1 22 ? 6 27 ? 11 32 ? 16 37 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 17 37 ? 21 37 ? 23 37 ? 24 37 ? 25 37 ? ...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 10ms
memory: 3712kb
input:
1000 45 20 19 19 19 21 18 18 18 19 13 18 18 17 8 1 45 16 21 11 9 17 20 10 8 9 4 6 5 7 1 45 10 12 22 15 11 13 22 14 9 7 8 7 6 1 1 45 15 5 7 17 14 4 8 18 5 6 5 7 1 45 11 19 18 12 12 20 17 11 10 14 11 10 1 1 45 16 21 11 1 17 20 10 2 2 1 1 45 19 22 18 18 18 22 19 19 17 9 5 3 4 1 1 45 5 15 22 12 6 16 21 ...
output:
? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 7 29 ? 42 29 ? 2 29 ? 4 29 ? 5 29 ? 5 13 ! 5 45 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 17 39 ? 12 39 ? 10 39 ? 11 39 ? 12 36 ! 12 42 ? 1 23 ? 6 28 ? 11 33 ? 16 38 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 2 23 ? 6 23 ? 3 23 ?...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 10ms
memory: 3712kb
input:
1000 46 18 8 4 14 18 8 4 14 5 6 5 1 1 46 9 3 13 23 9 3 13 23 4 2 1 1 1 46 22 12 10 10 22 12 10 10 11 7 8 7 6 11 1 46 19 19 19 19 19 19 19 19 18 14 15 15 14 1 1 46 5 15 23 13 5 15 23 13 6 7 6 1 1 46 21 11 7 11 21 11 7 11 6 4 6 5 1 1 46 18 8 6 14 18 8 6 14 5 7 5 6 1 1 46 16 8 8 16 16 8 8 16 7 4 2 3 1 ...
output:
? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 12 34 ? 9 34 ? 10 34 ? 11 31 ! 11 31 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 7 29 ? 5 29 ? 4 29 ? 4 29 ! 4 29 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 1 24 ? 6 29 ? 11 34 ? 16 39 ? 12 34 ? 6 34 ? 9 34 ? 8 34 ? 7 34 ? 7 29 ! 7...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 37ms
memory: 3584kb
input:
1000 1000000000 499999999 499999999 499999999 499999999 499999999 499999999 499999999 499999999 499999999 250000001 375000000 312500001 343750001 359375001 367187501 371093751 373046875 372070313 371582033 371826174 371948244 372009279 372039797 372055055 372047426 372043612 372045520 372046474 3720...
output:
? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 2 500000001 ? 750000002 500000001 ? 875000002 500000001 ? 812500002 500000001 ? 843750002 500000001 ? 859375002 500000001 ? 867187502 5000...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 45ms
memory: 3456kb
input:
1000 1000000000 499999969 499999969 499999969 499999969 499999969 499999969 499999969 499999969 499999968 249999985 124999993 62500028 93750026 109374994 101562495 97656245 95703151 96679714 97167964 96923824 96801754 96740750 96771237 96755978 96748380 96752164 96750257 96749303 96748857 96749096 9...
output:
? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 2 500000001 ? 249999985 500000001 ? 374999977 500000001 ? 437499973 500000001 ? 406249975 500000001 ? 390624976 500000001 ? 398437475 5000...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 41ms
memory: 3584kb
input:
1000 1000000000 474148191 224148191 25851811 275851811 474148191 224148191 25851811 275851811 25851812 12925906 19388859 16157382 14541644 13733775 13329840 13127873 13026889 12976397 12951151 12938528 12932217 12929061 12927483 12926694 12926300 12926103 12926004 12925955 12925930 12925918 12925912...
output:
? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 250000002 750000001 ? 237074096 750000001 ? 230611143 750000001 ? 233842620 750000001 ? 235458358 750000001 ? 236266227 750000001 ? 236670...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 34ms
memory: 3584kb
input:
1000 1000000000 230485382 480485382 269514620 19514620 230485382 480485382 269514620 19514620 19514619 9757310 14635895 12196567 10976903 10367071 10062155 9909697 9833468 9795354 9776297 9766768 9762004 9759622 9758431 9757835 9757537 9757388 9757314 9757277 9757292 9757283 9757278 9757276 9757275 ...
output:
? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 375000002 875000001 ? 384757311 875000001 ? 389635966 875000001 ? 387196638 875000001 ? 385976974 875000001 ? 385367142 875000001 ? 385062...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 50ms
memory: 3712kb
input:
1000 1000000000 288090905 288090905 295653197 454346805 288090905 288090905 295653197 454346805 288090906 348392257 276369531 252079542 258363849 249361008 247578122 247110298 246452767 246547620 246266281 246312098 246241764 246231113 246224181 246222321 246219785 246220123 246219024 246219236 2462...
output:
? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 1 500000001 ? 125000001 625000001 ? 250000001 750000001 ? 375000001 875000001 ? 2 500000001 ? 855954549 500000001 ? 927977275 500000001 ? 963988638 500000001 ? 945982957 500000001 ? 954985798 500000001 ? 959487218 5000...
result:
ok ok (1000 test cases)
Test #22:
score: 0
Accepted
time: 53ms
memory: 3712kb
input:
1000 999999999 499999998 499999998 499999999 499999999 499999999 499999999 499999998 499999998 499999997 250000000 374999999 312499999 281250000 296874999 289062499 285156249 283203124 282226562 281738281 281494140 281372071 281433105 281402588 281387329 281379701 281383515 281381608 281380655 28138...
output:
? 1 500000000 ? 125000000 624999999 ? 249999999 749999998 ? 374999998 874999997 ? 1 500000001 ? 125000000 625000000 ? 249999999 749999999 ? 374999998 874999998 ? 2 500000000 ? 250000000 500000000 ? 125000000 500000000 ? 187500000 500000000 ? 218750000 500000000 ? 203125000 500000000 ? 210937500 5000...
result:
ok ok (1000 test cases)
Test #23:
score: 0
Accepted
time: 33ms
memory: 3584kb
input:
1000 999999999 499999957 499999957 499999956 499999956 499999956 499999956 499999957 499999957 499999955 249999978 124999989 62499995 31250041 46875040 54687539 58593789 60546914 61523476 62011714 61767617 61889644 61828609 61798135 61813394 61821023 61824795 61822931 61823842 61823408 61823647 6182...
output:
? 1 500000000 ? 125000000 624999999 ? 249999999 749999998 ? 374999998 874999997 ? 1 500000001 ? 125000000 625000000 ? 249999999 749999999 ? 374999998 874999998 ? 250000000 749999998 ? 499999977 749999998 ? 624999966 749999998 ? 687499960 749999998 ? 718749957 749999998 ? 703124958 749999998 ? 695312...
result:
ok ok (1000 test cases)
Test #24:
score: 0
Accepted
time: 45ms
memory: 3584kb
input:
1000 999999999 324545945 74545947 175454053 425454051 324545944 74545946 175454054 425454052 74545945 37272973 55909459 46591216 41932094 39602533 38437753 37855363 37564168 37418570 37345771 37309372 37291172 37282072 37277522 37275247 37274110 37273541 37273257 37273115 37273044 37273008 37272990 ...
output:
? 1 500000000 ? 125000000 624999999 ? 249999999 749999998 ? 374999998 874999997 ? 1 500000001 ? 125000000 625000000 ? 249999999 749999999 ? 374999998 874999998 ? 125000001 625000000 ? 162272973 625000000 ? 180909459 625000000 ? 171591216 625000000 ? 166932094 625000000 ? 164602533 625000000 ? 163437...
result:
ok ok (1000 test cases)
Test #25:
score: 0
Accepted
time: 43ms
memory: 3584kb
input:
1000 999999999 487015083 262984920 12984922 237015078 487015084 262984919 12984921 237015079 12984920 6492461 9738625 8115510 7303952 6898173 6695284 6593839 6543117 6517756 6505075 6498735 6495565 6493980 6493187 6492791 6492593 6492494 6492444 6492437 6492431 6492431 6492428 6492429 12984855 1 999...
output:
? 1 500000000 ? 125000000 624999999 ? 249999999 749999998 ? 374999998 874999997 ? 1 500000001 ? 125000000 625000000 ? 249999999 749999999 ? 374999998 874999998 ? 250000000 749999999 ? 256492459 749999999 ? 259738689 749999999 ? 258115574 749999999 ? 257304016 749999999 ? 256898237 749999999 ? 256695...
result:
ok ok (1000 test cases)
Test #26:
score: 0
Accepted
time: 41ms
memory: 3712kb
input:
1000 999999999 265285129 249264885 249264885 484714867 265285128 249264884 249264884 484714868 249264885 139917572 186948663 155790553 140211498 132421970 136022808 134075426 133101735 132614889 132371466 132300259 132310610 132280182 132285046 132277439 132276378 132275538 132275427 132275063 13227...
output:
? 1 500000000 ? 125000000 624999999 ? 249999999 749999998 ? 374999998 874999997 ? 1 500000001 ? 125000000 625000000 ? 249999999 749999999 ? 374999998 874999998 ? 125000001 625000000 ? 367558 625000000 ? 62683779 625000000 ? 31525669 625000000 ? 15946614 625000000 ? 8157086 625000000 ? 4262322 625000...
result:
ok ok (1000 test cases)
Test #27:
score: 0
Accepted
time: 51ms
memory: 3584kb
input:
1000 536870912 261621269 141031917 108355805 127403541 261621269 141031917 108355805 127403541 108355804 54177903 74452666 60908190 54135952 50791785 52442892 51596362 51173097 50961465 50855649 50802741 50776287 50778558 50771945 50772980 50771326 50771119 50770912 50770913 50770810 50770860 507708...
output:
? 1 268435457 ? 67108865 335544321 ? 134217729 402653185 ? 201326593 469762049 ? 1 268435457 ? 67108865 335544321 ? 134217729 402653185 ? 201326593 469762049 ? 134217730 402653185 ? 188395631 402653185 ? 215484582 402653185 ? 201940106 402653185 ? 195167868 402653185 ? 191781749 402653185 ? 19347480...
result:
ok ok (1000 test cases)
Test #28:
score: 0
Accepted
time: 33ms
memory: 3712kb
input:
1000 536870911 244408485 244408485 244408485 249866272 244408484 244408484 244408484 249866271 244408485 146231213 183306363 176782274 192026189 184388424 180569541 181396922 180442202 180092180 180203522 180084182 180032510 180054347 180039430 180031971 180028780 180030107 180029175 180028709 18002...
output:
? 1 268435456 ? 67108864 335544319 ? 134217727 402653182 ? 201326590 469762045 ? 1 268435457 ? 67108864 335544320 ? 134217727 402653183 ? 201326590 469762046 ? 2 268435457 ? 414666670 268435457 ? 475768791 268435457 ? 445217731 268435457 ? 460493261 268435457 ? 468131026 268435457 ? 471949909 268435...
result:
ok ok (1000 test cases)
Extra Test:
score: 0
Extra Test Passed