QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#883500 | #9734. Identify Chord | Chendaqian | AC ✓ | 49ms | 3712kb | C++14 | 3.8kb | 2025-02-05 16:40:30 | 2025-02-05 16:40:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void Solve(int n);
int Ask(int x, int y);
void Report(int x, int y);
#define onlinejudge
#ifdef onlinejudge
namespace grader {
long long read() {
long long o=0,w=1;char c=getchar();
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') {o=o*10+c-'0';c=getchar();}
return o*w;
}
int n;
int Ask(int x, int y) {
if (x == y) return 0;
if ((x - y + n) % n == 1 || (y - x + n) % n == 1) return 1;
printf("? %d %d\n", x, y);
fflush(stdout);
return read();
}
void Report(int x, int y) {
printf("! %d %d\n", x, y);
fflush(stdout);
if (read() != 1) exit(0);
}
int main() {
int T = read();
while (T--) {
n = read();
Solve(n);
}
return 0;
}
}
int Ask(int x, int y) {
return grader::Ask(x, y);
}
void Report(int x, int y) {
grader::Report(x, y);
}
int main() {
return grader::main();
}
#else
namespace grader {
long long read() {
long long o=0,w=1;char c=getchar();
while(c<'0'||c>'9') {if(c=='-') w=-1;c=getchar();}
while(c>='0'&&c<='9') {o=o*10+c-'0';c=getchar();}
return o*w;
}
int n, sx, sy, cnt, fl1;
int dis(int x, int y) {
return min((x - y + n) % n, (y - x + n) % n);
}
int Ask(int x, int y) {
if (x == y) return 0;
if ((x - y + n) % n == 1 || (y - x + n) % n == 1) return 1;
int res = min({dis(x, y), dis(x, sx) + dis(y, sy) + 1, dis(x, sy) + dis(y, sx) + 1});
fprintf(stderr, "Ask(%d, %d): %d;\n", x, y, res);
if (++cnt > 40) {
fprintf(stderr, "WA! Too many queries!\n");
exit(1);
}
return res;
}
void Report(int x, int y) {
fprintf(stderr, "Report(%d, %d);\n", x, y);
if (x > y) swap(x, y);
if (x != sx || y != sy) {
fprintf(stderr, "WA! You Return (%d, %d).\n", x, y);
exit(1);
}
fl1 = 1;
}
int main() {
int T = read();
while (T--) {
n = read(), sx = read(), sy = read();
if (sx > sy) swap(sx, sy);
cnt = 0, fl1 = 0;
Solve(n);
if (!fl1) {
fprintf(stderr, "WA! No return!\n");
exit(1);
}
cerr << "OK!\n";
}
return 0;
}
}
int Ask(int x, int y) {
return grader::Ask(x, y);
}
void Report(int x, int y) {
grader::Report(x, y);
}
int main() {
return grader::main();
}
#endif
void Solve(int n) {
auto dis=[&](int x,int y) {
return min((x-y+n)%n,(y-x+n)%n);
};
auto pre=[&](int x,int k) {
return (x-1-k+n)%n+1;
};
auto suf=[&](int x,int k) {
return (x-1+k)%n+1;
};
int sx=0,sy=0,d=0;
bool fd=0;
for(int i:{1,n,2}) {
for(int j=n/2;j<=n/2+(n&1);j++) {
sx=i,sy=suf(i,j);
d=Ask(sx,sy);
if(d!=dis(sx,sy)) {
fd=1;
break;
}
}
if(fd) break;
}
if(sx>sy) swap(sx,sy);
if(d==1) {
Report(sx,sy);
return;
}
// cerr<<d<<'\n';
// cerr<<sx<<' '<<sy<<'\n';
int d1=Ask(pre(sx,1),sy),e1=Ask(sx,pre(sy,1));
int d2=Ask(suf(sx,1),sy),e2=Ask(sx,suf(sy,1));
// cerr<<d1<<' '<<d2<<'\n';
// cerr<<e1<<' '<<e2<<'\n';
int rt=0,pd=0;
if(d1==d2) {
rt=sx;
if(e1<e2) pd=(sy-sx+n)%n-d+1;
else pd=(sx-sy+n)%n-d+1;
}
else if(d1<d2) {
// cerr<<"toL\n";
int delt=(sx-sy+n)%n-d;
int l=1,r=(sx-sy+n)%n,res=0;
while(l<=r) {
int mid=(l+r)/2,x=pre(sx,mid);
if(dis(x,sy)==Ask(x,sy)+delt) res=mid,l=mid+1;
else r=mid-1;
}
rt=pre(sx,res);
if(e1<=e2) pd=(sx-sy+n)%n+(d-1)-(sx-rt+n)%n*2;
else pd=(sx-sy+n)%n-(d-1);
} else {
// cerr<<"toR\n";
int delt=(sy-sx+n)%n-d;
int l=1,r=(sy-sx+n)%n,res=0;
while(l<=r) {
int mid=(l+r)/2,x=suf(sx,mid);
if(dis(x,sy)==Ask(x,sy)+delt) res=mid,l=mid+1;
else r=mid-1;
}
rt=suf(sx,res);
if(e1>=e2) pd=(sy-sx+n)%n+(d-1)-(rt-sx+n)%n*2;
else pd=(sy-sx+n)%n-(d-1);
}
// cerr<<rt<<' '<<pd<<'\n';
if(Ask(rt,pre(rt,pd))==1) Report(rt,pre(rt,pd));
else Report(rt,suf(rt,pd));
}
/*
cd QOJ9734
g++ a.cpp -o a -std=c++14 -Wall -O2
time ./a
*/
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
2 6 2 2 2 1 2 1 2 1 4 1 1
output:
? 1 4 ? 6 4 ? 1 3 ? 2 4 ? 1 5 ? 2 4 ? 2 6 ! 2 4 ? 1 3 ! 1 3
result:
ok ok (2 test cases)
Test #2:
score: 0
Accepted
time: 11ms
memory: 3712kb
input:
1000 15 5 6 6 4 6 1 2 3 1 19 5 6 6 4 4 4 3 4 2 1 17 5 6 6 4 4 4 3 4 2 1 15 6 7 5 6 7 3 5 6 2 1 14 5 6 4 4 6 3 5 4 3 1 15 3 4 4 2 2 3 3 2 2 1 17 8 8 7 6 6 8 7 4 5 4 1 1 20 6 7 5 7 7 5 1 13 5 4 4 5 6 3 3 2 1 1 18 3 2 4 4 2 4 3 2 1 1 13 4 3 5 5 3 3 4 3 1 1 14 2 1 3 3 3 3 2 1 1 1 17 8 7 7 8 6 6 2 2 3 5 ...
output:
? 1 8 ? 15 8 ? 1 7 ? 2 8 ? 1 9 ? 5 8 ? 6 8 ? 5 2 ! 5 8 ? 1 10 ? 19 10 ? 1 9 ? 2 10 ? 1 11 ? 6 10 ? 3 10 ? 4 10 ? 3 13 ! 3 12 ? 1 9 ? 17 9 ? 1 8 ? 2 9 ? 1 10 ? 5 9 ? 3 9 ? 4 9 ? 3 12 ! 3 11 ? 1 8 ? 15 8 ? 1 7 ? 2 8 ? 1 9 ? 5 8 ? 3 8 ? 2 8 ? 1 14 ! 1 3 ? 1 8 ? 14 8 ? 1 7 ? 2 8 ? 1 9 ? 5 8 ? 3 8 ? 2 8 ...
result:
ok ok (1000 test cases)
Test #3:
score: 0
Accepted
time: 6ms
memory: 3712kb
input:
1000 21 3 2 2 4 4 5 4 2 3 1 1 22 8 9 9 7 7 5 7 7 6 7 1 20 5 6 6 4 6 2 3 2 1 6 1 22 10 10 10 9 9 4 2 4 7 1 21 9 10 9 8 8 4 2 3 3 6 1 21 8 7 9 9 7 5 5 6 1 1 24 11 10 10 11 11 5 3 4 4 1 1 22 10 9 10 10 9 4 2 3 2 1 1 21 4 5 5 3 3 5 4 3 2 1 23 8 7 9 9 7 6 9 7 8 1 1 21 10 10 9 8 8 10 9 5 7 7 1 1 24 9 10 1...
output:
? 1 11 ? 21 11 ? 1 10 ? 2 11 ? 1 12 ? 16 11 ? 19 11 ? 21 11 ? 20 11 ? 21 10 ! 21 10 ? 1 12 ? 22 12 ? 1 11 ? 2 12 ? 1 13 ? 7 12 ? 4 12 ? 2 12 ? 3 12 ? 3 11 ! 3 17 ? 1 11 ? 20 11 ? 1 10 ? 2 11 ? 1 12 ? 6 11 ? 3 11 ? 4 11 ? 5 11 ? 5 19 ! 5 11 ? 1 12 ? 22 12 ? 1 11 ? 2 12 ? 1 13 ? 7 12 ? 10 12 ? 8 12 ? ...
result:
ok ok (1000 test cases)
Test #4:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
1000 25 8 9 7 9 9 5 1 25 6 5 5 7 7 6 7 5 6 1 1 25 11 10 10 11 12 6 8 8 9 1 1 25 5 6 4 4 6 6 4 4 3 8 1 26 12 11 12 12 11 5 3 5 1 1 26 11 10 10 12 12 6 10 10 9 1 1 26 13 11 10 12 12 12 4 1 2 1 1 27 12 13 11 11 13 5 3 5 2 1 25 9 8 10 10 10 2 3 1 2 1 1 27 9 10 8 8 10 6 6 8 7 5 1 27 11 10 12 12 10 4 3 5 ...
output:
? 1 13 ? 25 13 ? 1 12 ? 2 13 ? 1 14 ? 1 21 ! 1 6 ? 1 13 ? 25 13 ? 1 12 ? 2 13 ? 1 14 ? 19 13 ? 23 13 ? 25 13 ? 24 13 ? 25 9 ! 25 9 ? 1 13 ? 25 13 ? 1 12 ? 2 13 ? 1 14 ? 19 13 ? 23 13 ? 21 13 ? 22 13 ? 23 6 ! 23 6 ? 1 13 ? 25 13 ? 1 12 ? 2 13 ? 1 14 ? 7 13 ? 4 13 ? 2 13 ? 3 13 ? 3 20 ! 3 11 ? 1 14 ? ...
result:
ok ok (1000 test cases)
Test #5:
score: 0
Accepted
time: 16ms
memory: 3712kb
input:
1000 29 10 11 11 9 9 7 9 9 8 10 1 28 13 12 12 13 13 7 10 8 8 1 1 30 3 4 4 2 2 7 5 3 2 1 1 29 4 5 3 3 5 7 5 3 4 8 1 28 8 7 7 9 9 3 5 3 2 1 1 29 6 7 7 5 5 7 5 5 4 2 1 29 9 8 10 10 8 7 7 7 6 1 1 28 11 12 10 10 12 4 3 5 5 4 1 30 4 3 5 5 5 6 2 2 1 1 1 30 8 7 7 9 9 4 4 2 3 1 1 28 11 12 12 10 10 4 3 2 3 6 ...
output:
? 1 15 ? 29 15 ? 1 14 ? 2 15 ? 1 16 ? 8 15 ? 4 15 ? 2 15 ? 3 15 ? 3 13 ! 3 22 ? 1 15 ? 28 15 ? 1 14 ? 2 15 ? 1 16 ? 22 15 ? 26 15 ? 24 15 ? 23 15 ? 24 8 ! 24 8 ? 1 16 ? 30 16 ? 1 15 ? 2 16 ? 1 17 ? 9 16 ? 5 16 ? 3 16 ? 2 16 ? 2 17 ! 2 17 ? 1 15 ? 29 15 ? 1 14 ? 2 15 ? 1 16 ? 8 15 ? 4 15 ? 2 15 ? 3 1...
result:
ok ok (1000 test cases)
Test #6:
score: 0
Accepted
time: 11ms
memory: 3712kb
input:
1000 32 13 14 12 12 14 8 9 10 10 4 1 30 14 13 14 14 13 7 11 12 11 1 1 32 16 14 13 13 15 15 8 10 8 7 1 1 31 5 6 4 4 6 7 3 3 2 10 1 32 7 8 8 6 6 8 7 5 6 5 1 32 8 9 9 7 7 8 10 8 7 11 1 31 15 14 14 15 13 13 6 4 4 3 7 1 31 6 5 7 7 5 8 8 6 5 1 1 32 12 13 11 11 13 4 4 4 3 5 1 30 14 13 14 14 13 7 10 9 9 1 1...
output:
? 1 17 ? 32 17 ? 1 16 ? 2 17 ? 1 18 ? 9 17 ? 5 17 ? 7 17 ? 6 17 ? 5 1 ! 5 9 ? 1 16 ? 30 16 ? 1 15 ? 2 16 ? 1 17 ? 23 16 ? 27 16 ? 29 16 ? 28 16 ? 28 26 ! 28 26 ? 1 17 ? 32 16 ? 15 32 ? 16 31 ? 17 32 ? 16 1 ? 8 32 ? 12 32 ? 10 32 ? 9 32 ? 9 26 ! 9 26 ? 1 16 ? 31 16 ? 1 15 ? 2 16 ? 1 17 ? 9 16 ? 5 16 ...
result:
ok ok (1000 test cases)
Test #7:
score: 0
Accepted
time: 14ms
memory: 3584kb
input:
1000 34 17 16 15 15 16 16 7 4 5 4 1 1 33 8 9 7 7 9 6 4 4 3 9 1 33 11 10 12 12 10 8 9 9 8 1 1 34 11 10 10 12 12 8 9 9 8 1 1 34 11 12 12 10 10 8 13 11 10 9 1 35 14 15 13 15 15 4 1 34 8 7 7 9 9 8 8 6 7 1 1 34 14 15 15 13 13 8 10 11 11 11 1 34 16 16 15 15 16 8 13 14 13 2 1 33 9 8 10 10 8 8 5 5 4 1 1 33 ...
output:
? 1 18 ? 34 17 ? 16 34 ? 17 33 ? 18 34 ? 17 1 ? 8 34 ? 4 34 ? 6 34 ? 5 34 ? 5 31 ! 5 31 ? 1 17 ? 33 17 ? 1 16 ? 2 17 ? 1 18 ? 9 17 ? 5 17 ? 7 17 ? 6 17 ? 6 30 ! 6 15 ? 1 17 ? 33 17 ? 1 16 ? 2 17 ? 1 18 ? 25 17 ? 30 17 ? 32 17 ? 31 17 ? 31 24 ! 31 24 ? 1 18 ? 34 18 ? 1 17 ? 2 18 ? 1 19 ? 26 18 ? 31 1...
result:
ok ok (1000 test cases)
Test #8:
score: 0
Accepted
time: 11ms
memory: 3712kb
input:
1000 36 18 17 17 16 17 17 2 1 36 3 2 4 4 4 8 3 1 2 1 1 36 13 14 12 12 14 9 11 11 10 6 1 36 5 6 4 4 6 9 5 3 4 9 1 36 18 17 16 16 17 17 8 4 6 5 5 1 1 36 12 13 13 11 11 3 4 5 4 11 1 35 13 12 14 14 12 6 9 7 6 5 1 1 36 13 14 14 12 12 4 4 4 3 10 1 36 14 15 15 13 13 9 10 10 9 7 1 36 16 17 15 15 17 9 12 10 ...
output:
? 1 19 ? 36 18 ? 17 36 ? 18 35 ? 19 36 ? 18 1 ? 18 16 ! 18 20 ? 1 19 ? 36 19 ? 1 18 ? 2 19 ? 1 20 ? 28 19 ? 33 19 ? 35 19 ? 34 19 ? 35 19 ! 35 19 ? 1 19 ? 36 19 ? 1 18 ? 2 19 ? 1 20 ? 10 19 ? 5 19 ? 3 19 ? 4 19 ? 4 34 ! 4 10 ? 1 19 ? 36 19 ? 1 18 ? 2 19 ? 1 20 ? 10 19 ? 5 19 ? 3 19 ? 4 19 ? 3 25 ! 3...
result:
ok ok (1000 test cases)
Test #9:
score: 0
Accepted
time: 5ms
memory: 3712kb
input:
1000 37 17 16 16 17 18 7 4 7 6 1 1 36 17 16 17 17 16 8 4 7 8 1 1 38 9 10 8 8 10 7 4 4 3 11 1 37 15 16 16 14 14 6 4 4 3 4 8 1 37 12 11 13 13 13 2 4 2 1 1 1 36 8 7 9 9 7 9 6 6 5 1 1 37 6 5 7 7 5 9 7 4 5 1 1 37 18 18 16 15 15 17 17 9 12 10 9 8 1 1 37 17 16 17 17 18 7 2 2 1 1 1 37 8 9 9 7 7 7 4 4 3 8 1 ...
output:
? 1 19 ? 37 19 ? 1 18 ? 2 19 ? 1 20 ? 28 19 ? 23 19 ? 26 19 ? 27 19 ? 27 14 ! 27 14 ? 1 19 ? 36 19 ? 1 18 ? 2 19 ? 1 20 ? 28 19 ? 23 19 ? 26 19 ? 27 19 ? 28 26 ! 28 26 ? 1 20 ? 38 20 ? 1 19 ? 2 20 ? 1 21 ? 11 20 ? 6 20 ? 8 20 ? 7 20 ? 7 34 ! 7 18 ? 1 19 ? 37 19 ? 1 18 ? 2 19 ? 1 20 ? 10 19 ? 15 19 ?...
result:
ok ok (1000 test cases)
Test #10:
score: 0
Accepted
time: 10ms
memory: 3712kb
input:
1000 39 18 19 18 17 17 8 4 6 6 12 1 38 8 7 9 9 7 6 3 3 2 1 1 38 19 17 16 16 18 18 9 14 15 14 13 1 1 39 12 13 11 11 13 9 14 12 11 8 1 38 15 14 16 16 14 5 4 3 2 3 1 1 39 4 5 5 5 3 1 1 39 18 17 17 18 19 10 15 16 17 1 1 38 18 18 18 17 18 8 3 1 2 1 39 14 15 15 15 13 1 1 39 11 12 10 10 12 7 6 4 5 9 1 39 9...
output:
? 1 20 ? 39 20 ? 1 19 ? 2 20 ? 1 21 ? 11 20 ? 16 20 ? 13 20 ? 14 20 ? 13 1 ! 13 25 ? 1 20 ? 38 20 ? 1 19 ? 2 20 ? 1 21 ? 29 20 ? 34 20 ? 32 20 ? 33 20 ? 33 21 ! 33 21 ? 1 20 ? 38 19 ? 18 38 ? 19 37 ? 20 38 ? 19 1 ? 9 38 ? 14 38 ? 17 38 ? 16 38 ? 15 38 ? 15 26 ! 15 26 ? 1 20 ? 39 20 ? 1 19 ? 2 20 ? 1...
result:
ok ok (1000 test cases)
Test #11:
score: 0
Accepted
time: 16ms
memory: 3712kb
input:
1000 40 12 13 13 11 11 10 7 7 6 3 1 40 18 19 19 17 17 8 5 8 7 11 1 40 15 16 16 14 14 10 15 13 14 10 1 40 8 9 7 9 9 13 1 40 16 15 17 17 15 6 5 4 3 4 1 1 40 15 14 14 16 16 9 10 8 7 8 1 1 41 13 14 12 14 14 8 1 40 7 6 8 8 6 10 6 5 4 5 1 1 40 18 17 19 19 17 8 3 2 4 1 1 40 6 7 5 5 7 10 5 4 3 4 11 1 40 4 5...
output:
? 1 21 ? 40 21 ? 1 20 ? 2 21 ? 1 22 ? 11 21 ? 6 21 ? 8 21 ? 7 21 ? 7 28 ! 7 26 ? 1 21 ? 40 21 ? 1 20 ? 2 21 ? 1 22 ? 11 21 ? 16 21 ? 13 21 ? 12 21 ? 12 37 ! 12 27 ? 1 21 ? 40 21 ? 1 20 ? 2 21 ? 1 22 ? 11 21 ? 6 21 ? 3 21 ? 4 21 ? 3 13 ! 3 33 ? 1 21 ? 40 21 ? 1 20 ? 2 21 ? 1 22 ? 1 28 ! 1 14 ? 1 21 ?...
result:
ok ok (1000 test cases)
Test #12:
score: 0
Accepted
time: 9ms
memory: 3712kb
input:
1000 42 11 12 10 10 12 10 6 9 7 11 1 41 17 16 18 18 16 10 14 15 14 13 1 1 41 8 7 7 9 9 10 9 6 7 1 1 41 12 11 11 13 13 10 7 8 6 7 1 1 41 12 13 13 11 11 4 7 5 4 3 13 1 41 18 17 17 19 19 10 13 13 14 1 1 41 14 13 15 15 13 10 16 14 13 1 1 41 20 20 20 20 19 20 19 18 18 10 14 12 11 10 2 1 41 17 16 16 18 18...
output:
? 1 22 ? 42 22 ? 1 21 ? 2 22 ? 1 23 ? 12 22 ? 6 22 ? 9 22 ? 7 22 ? 6 37 ! 6 17 ? 1 21 ? 41 21 ? 1 20 ? 2 21 ? 1 22 ? 31 21 ? 37 21 ? 40 21 ? 39 21 ? 38 21 ? 38 33 ! 38 33 ? 1 21 ? 41 21 ? 1 20 ? 2 21 ? 1 22 ? 31 21 ? 37 21 ? 40 21 ? 39 21 ? 40 16 ! 40 16 ? 1 21 ? 41 21 ? 1 20 ? 2 21 ? 1 22 ? 31 21 ?...
result:
ok ok (1000 test cases)
Test #13:
score: 0
Accepted
time: 21ms
memory: 3712kb
input:
1000 43 4 5 3 3 5 10 5 2 3 8 1 42 18 19 17 17 19 7 4 5 4 3 4 1 43 6 7 5 5 7 9 3 4 3 2 12 1 43 18 17 17 19 19 11 13 10 9 10 1 1 43 21 21 20 19 19 21 20 9 4 2 4 1 1 43 17 16 16 18 18 11 12 14 13 1 1 43 18 19 17 17 19 10 16 16 17 4 1 43 21 21 20 19 21 21 20 9 4 1 1 1 42 13 12 14 14 12 10 8 9 7 8 1 1 42...
output:
? 1 22 ? 43 22 ? 1 21 ? 2 22 ? 1 23 ? 12 22 ? 6 22 ? 3 22 ? 4 22 ? 3 28 ! 3 21 ? 1 22 ? 42 22 ? 1 21 ? 2 22 ? 1 23 ? 12 22 ? 17 22 ? 14 22 ? 15 22 ? 16 22 ? 16 12 ! 16 20 ? 1 22 ? 43 22 ? 1 21 ? 2 22 ? 1 23 ? 12 22 ? 6 22 ? 3 22 ? 4 22 ? 5 22 ? 5 32 ! 5 21 ? 1 22 ? 43 22 ? 1 21 ? 2 22 ? 1 23 ? 33 22...
result:
ok ok (1000 test cases)
Test #14:
score: 0
Accepted
time: 11ms
memory: 3712kb
input:
1000 44 22 20 19 19 21 21 9 5 6 5 4 1 1 44 11 12 12 10 10 11 8 9 8 7 5 1 43 11 10 12 12 10 6 6 3 4 1 1 43 21 21 19 18 18 20 20 10 16 17 16 17 1 1 44 19 20 20 18 18 11 17 19 18 6 1 44 16 17 15 15 17 11 13 14 13 12 7 1 44 17 16 16 18 18 6 5 3 4 1 1 44 10 11 11 9 9 7 5 4 4 3 11 1 43 13 12 12 14 14 4 8 ...
output:
? 1 23 ? 44 22 ? 21 44 ? 22 43 ? 23 44 ? 22 1 ? 11 44 ? 5 44 ? 8 44 ? 7 44 ? 6 44 ? 6 41 ! 6 41 ? 1 23 ? 44 23 ? 1 22 ? 2 23 ? 1 24 ? 12 23 ? 6 23 ? 3 23 ? 4 23 ? 5 23 ? 5 25 ! 5 29 ? 1 22 ? 43 22 ? 1 21 ? 2 22 ? 1 23 ? 33 22 ? 39 22 ? 36 22 ? 35 22 ? 36 24 ! 36 24 ? 1 22 ? 1 23 ? 43 21 ? 20 43 ? 21...
result:
ok ok (1000 test cases)
Test #15:
score: 0
Accepted
time: 12ms
memory: 3712kb
input:
1000 45 20 19 19 21 21 11 17 20 19 20 1 1 45 16 15 15 17 17 11 14 13 12 13 1 1 45 10 11 9 9 11 11 7 8 7 6 13 1 45 15 16 16 14 14 11 10 13 11 8 1 45 11 12 10 10 12 11 14 11 10 12 1 45 16 15 15 17 17 11 10 9 9 8 1 1 45 19 18 20 20 18 7 5 4 5 1 1 45 5 4 4 6 6 11 5 2 3 1 1 44 19 18 20 20 18 11 14 13 13 ...
output:
? 1 23 ? 45 23 ? 1 22 ? 2 23 ? 1 24 ? 34 23 ? 40 23 ? 43 23 ? 45 23 ? 44 23 ? 45 5 ! 45 5 ? 1 23 ? 45 23 ? 1 22 ? 2 23 ? 1 24 ? 34 23 ? 40 23 ? 43 23 ? 42 23 ? 41 23 ? 42 12 ! 42 12 ? 1 23 ? 45 23 ? 1 22 ? 2 23 ? 1 24 ? 12 23 ? 6 23 ? 3 23 ? 4 23 ? 5 23 ? 5 37 ! 5 18 ? 1 23 ? 45 23 ? 1 22 ? 2 23 ? 1...
result:
ok ok (1000 test cases)
Test #16:
score: 0
Accepted
time: 12ms
memory: 3712kb
input:
1000 46 18 19 19 17 17 10 12 9 8 9 7 1 46 9 10 10 8 8 11 9 6 7 5 1 46 22 22 22 21 21 11 16 14 16 14 1 46 19 20 18 18 20 11 15 16 15 14 5 1 46 5 6 4 6 6 9 1 46 21 22 22 20 20 9 5 8 8 9 13 1 46 18 19 19 17 17 8 12 9 8 7 11 1 46 16 17 17 15 15 6 10 7 6 5 15 1 46 22 21 22 22 21 10 4 2 3 2 1 1 46 5 6 6 4...
output:
? 1 24 ? 46 24 ? 1 23 ? 2 24 ? 1 25 ? 13 24 ? 7 24 ? 10 24 ? 11 24 ? 12 24 ? 11 37 ! 11 31 ? 1 24 ? 46 24 ? 1 23 ? 2 24 ? 1 25 ? 13 24 ? 7 24 ? 4 24 ? 5 24 ? 4 25 ! 4 29 ? 1 24 ? 46 24 ? 1 23 ? 2 24 ? 1 25 ? 13 24 ? 7 24 ? 10 24 ? 8 24 ? 7 21 ! 7 39 ? 1 24 ? 46 24 ? 1 23 ? 2 24 ? 1 25 ? 13 24 ? 7 24...
result:
ok ok (1000 test cases)
Test #17:
score: 0
Accepted
time: 48ms
memory: 3712kb
input:
1000 1000000000 499999999 499999998 499999999 499999999 499999998 250000000 374999999 312500000 343750000 359375000 367187500 371093750 373046874 372070312 371582032 371826173 371948243 372009278 372039796 372055054 372047425 372043611 372045519 372046473 372046950 372047188 372047307 372047367 3720...
output:
? 1 500000001 ? 1000000000 500000001 ? 1 500000000 ? 2 500000001 ? 1 500000002 ? 750000001 500000001 ? 875000001 500000001 ? 812500001 500000001 ? 843750001 500000001 ? 859375001 500000001 ? 867187501 500000001 ? 871093751 500000001 ? 873046876 500000001 ? 872070314 500000001 ? 871582033 500000001 ?...
result:
ok ok (1000 test cases)
Test #18:
score: 0
Accepted
time: 36ms
memory: 3712kb
input:
1000 1000000000 499999969 499999970 499999968 499999968 499999970 249999969 124999969 62500000 93750000 109374969 101562469 97656219 95703125 96679688 97167938 96923798 96801728 96740724 96771211 96755952 96748354 96752138 96750231 96749277 96748831 96749070 96749158 96749099 96749100 96749110 96749...
output:
? 1 500000001 ? 1000000000 500000001 ? 1 500000000 ? 2 500000001 ? 1 500000002 ? 250000001 500000001 ? 375000001 500000001 ? 437500001 500000001 ? 406250001 500000001 ? 390625001 500000001 ? 398437501 500000001 ? 402343751 500000001 ? 404296876 500000001 ? 403320313 500000001 ? 402832032 500000001 ?...
result:
ok ok (1000 test cases)
Test #19:
score: 0
Accepted
time: 32ms
memory: 3712kb
input:
1000 1000000000 474148191 474148192 474148192 474148190 474148190 250000000 349148191 286648191 255398191 239773191 242187501 238281251 237820066 237304688 237331785 237087645 237182617 237121582 237091064 237075805 237080016 237076202 237074295 237074851 237074374 237074135 237074176 237074117 2370...
output:
? 1 500000001 ? 1000000000 500000001 ? 1 500000000 ? 2 500000001 ? 1 500000002 ? 250000001 500000001 ? 125000001 500000001 ? 187500001 500000001 ? 218750001 500000001 ? 234375001 500000001 ? 242187501 500000001 ? 238281251 500000001 ? 236328126 500000001 ? 237304688 500000001 ? 236816407 500000001 ?...
result:
ok ok (1000 test cases)
Test #20:
score: 0
Accepted
time: 41ms
memory: 3712kb
input:
1000 1000000000 230485382 230485381 230485381 230485383 230485383 249999930 124999930 167985382 136735382 121110382 117187430 117204132 115251007 116210867 115722586 115478445 115356375 115295340 115264822 115249563 115243378 115245748 115243841 115242887 115242902 115242664 115242767 115242707 1152...
output:
? 1 500000001 ? 1000000000 500000001 ? 1 500000000 ? 2 500000001 ? 1 500000002 ? 750000001 500000001 ? 875000001 500000001 ? 937500001 500000001 ? 906250001 500000001 ? 890625001 500000001 ? 882812501 500000001 ? 886718751 500000001 ? 884765626 500000001 ? 883789064 500000001 ? 884277345 500000001 ?...
result:
ok ok (1000 test cases)
Test #21:
score: 0
Accepted
time: 40ms
memory: 3712kb
input:
1000 1000000000 288090905 288090904 288090906 288090906 288090904 250000000 329346805 266846805 256840905 251221805 249028405 247315555 247075280 246338992 246586999 246342859 246220789 246277956 246247438 246232179 246224550 246220735 246218882 246219781 246219304 246219066 246218947 246218887 2462...
output:
? 1 500000001 ? 1000000000 500000001 ? 1 500000000 ? 2 500000001 ? 1 500000002 ? 750000001 500000001 ? 875000001 500000001 ? 937500001 500000001 ? 968750001 500000001 ? 953125001 500000001 ? 960937501 500000001 ? 957031251 500000001 ? 958984376 500000001 ? 958007814 500000001 ? 958496095 500000001 ?...
result:
ok ok (1000 test cases)
Test #22:
score: 0
Accepted
time: 29ms
memory: 3584kb
input:
1000 999999999 499999998 499999999 499999997 499999997 499999999 249999999 374999998 312499998 281249999 296874998 289062498 285156248 283203123 282226561 281738280 281494139 281372070 281433104 281402587 281387328 281379700 281383514 281381607 281380654 281381131 281381370 281381488 281381430 28138...
output:
? 1 500000000 ? 999999999 500000000 ? 1 499999999 ? 2 500000000 ? 1 500000001 ? 250000001 500000000 ? 125000001 500000000 ? 187500001 500000000 ? 218750001 500000000 ? 203125001 500000000 ? 210937501 500000000 ? 214843751 500000000 ? 216796876 500000000 ? 217773438 500000000 ? 218261719 500000000 ? ...
result:
ok ok (1000 test cases)
Test #23:
score: 0
Accepted
time: 24ms
memory: 3712kb
input:
1000 999999999 499999957 499999956 499999958 499999958 499999956 249999957 125000000 187500000 218749957 203124957 195312457 191406207 189453082 188476520 187988282 188232380 188110353 188171388 188201863 188186604 188178975 188175203 188177068 188176157 188176591 188176353 188176234 188176174 18817...
output:
? 1 500000000 ? 999999999 500000000 ? 1 499999999 ? 2 500000000 ? 1 500000001 ? 750000000 500000000 ? 625000000 500000000 ? 687500000 500000000 ? 718750000 500000000 ? 703125000 500000000 ? 695312500 500000000 ? 691406250 500000000 ? 689453125 500000000 ? 688476563 500000000 ? 687988282 500000000 ? ...
result:
ok ok (1000 test cases)
Test #24:
score: 0
Accepted
time: 37ms
memory: 3584kb
input:
1000 999999999 324545945 324545946 324545946 324545944 324545944 249999999 199545945 187500001 168295945 171875001 164062501 164389695 162436570 163085938 162597657 162353516 162314500 162292481 162283983 162277222 162276354 162273407 162274447 162273493 162273016 162273168 162273049 162272989 16227...
output:
? 1 500000000 ? 999999999 500000000 ? 1 499999999 ? 2 500000000 ? 1 500000001 ? 250000001 500000000 ? 125000001 500000000 ? 187500001 500000000 ? 156250001 500000000 ? 171875001 500000000 ? 164062501 500000000 ? 160156251 500000000 ? 162109376 500000000 ? 163085938 500000000 ? 162597657 500000000 ? ...
result:
ok ok (1000 test cases)
Test #25:
score: 0
Accepted
time: 32ms
memory: 3584kb
input:
1000 999999999 487015083 487015082 487015082 487015084 487015084 249999935 362015083 299515083 268265083 252640083 244827583 246093685 244140560 243851021 243652278 243606881 243530207 243545846 243515329 243514948 243507700 243511133 243509225 243508271 243507794 243507556 243507581 243507522 24350...
output:
? 1 500000000 ? 999999999 500000000 ? 1 499999999 ? 2 500000000 ? 1 500000001 ? 750000000 500000000 ? 875000000 500000000 ? 812500000 500000000 ? 781250000 500000000 ? 765625000 500000000 ? 757812500 500000000 ? 753906250 500000000 ? 755859375 500000000 ? 756835938 500000000 ? 756347657 500000000 ? ...
result:
ok ok (1000 test cases)
Test #26:
score: 0
Accepted
time: 29ms
memory: 3712kb
input:
1000 999999999 265285129 265285130 265285130 265285128 265285128 249999999 374264885 311764885 280514885 264889885 257472629 260983635 259030510 258053947 257565666 257321525 257350559 257289524 257291007 257275748 257281895 257278081 257276174 257275220 257275271 257275032 257275101 257275042 25727...
output:
? 1 500000000 ? 999999999 500000000 ? 1 499999999 ? 2 500000000 ? 1 500000001 ? 250000001 500000000 ? 125000001 500000000 ? 62500001 500000000 ? 31250001 500000000 ? 15625001 500000000 ? 7812501 500000000 ? 11718751 500000000 ? 9765626 500000000 ? 8789063 500000000 ? 8300782 500000000 ? 8056641 5000...
result:
ok ok (1000 test cases)
Test #27:
score: 0
Accepted
time: 34ms
memory: 3712kb
input:
1000 536870912 261621269 261621268 261621268 261621270 261621270 127403541 67108864 93849109 77071893 75497472 79691776 78290725 77242149 76717861 76809749 76678677 76652325 76645909 76635941 76637717 76633621 76633893 76632869 76633109 76632853 76632741 76632789 76632757 76632741 76632733 76632737 ...
output:
? 1 268435457 ? 536870912 268435457 ? 1 268435456 ? 2 268435457 ? 1 268435458 ? 402653185 268435457 ? 335544321 268435457 ? 369098753 268435457 ? 352321537 268435457 ? 343932929 268435457 ? 348127233 268435457 ? 350224385 268435457 ? 351272961 268435457 ? 351797249 268435457 ? 352059393 268435457 ? ...
result:
ok ok (1000 test cases)
Test #28:
score: 0
Accepted
time: 49ms
memory: 3584kb
input:
1000 536870911 244408485 244408484 244408486 244408486 244408484 134217728 182757403 210854053 194076837 185688229 181493925 180660251 180445349 180135963 180183205 180052133 180070427 180037659 180035749 180029467 180031653 180029605 180028581 180028955 180028699 180028571 180028517 180028539 18002...
output:
? 1 268435456 ? 536870911 268435456 ? 1 268435455 ? 2 268435456 ? 1 268435457 ? 402653184 268435456 ? 469762048 268435456 ? 503316480 268435456 ? 486539264 268435456 ? 478150656 268435456 ? 473956352 268435456 ? 471859200 268435456 ? 472907776 268435456 ? 472383488 268435456 ? 472645632 268435456 ? ...
result:
ok ok (1000 test cases)
Extra Test:
score: 0
Extra Test Passed