QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#574157 | #6394. Turn on the Light | wlkmok369 | WA | 1ms | 3732kb | C++20 | 832b | 2024-09-18 20:57:23 | 2024-09-18 20:57:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int now = 0, ago = 0;
for (int i = 1; i <= min(n, 5); i++)
{
cout << "?" << " " << i << endl;
cin >> now;
if (now == ago)
{
cout << "!" << " " << i << endl;
return 0;
}
ago = now;
}
int lo = 6, hi = n;
while (lo <= hi)
{
int mid = (lo + hi) / 2;
cout << "?" << " " << mid << endl;
cin >> now;
if (now == ago)
{
cout << "!" << " " << mid << endl;
return 0;
}
else
{
if (now > ago)
lo = mid + 1;
else
hi = mid - 1;
}
ago = now;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3712kb
input:
3 1 2 2
output:
? 1 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #2:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
10 1 2 3 4 5 4 4
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 8 ? 6 ! 6
result:
ok Correct position at 6
Test #3:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
9 1 2 3 4 5 6 6
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 7 ? 8 ! 8
result:
ok Correct position at 8
Test #4:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
8 1 2 3 4 5 6 6
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 7 ? 8 ! 8
result:
ok Correct position at 8
Test #5:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
7 1 2 3 4 5 5
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ! 6
result:
ok Correct position at 6
Test #6:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
6 1 2 3 4 5 5
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ! 6
result:
ok Correct position at 6
Test #7:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
5 1 2 3 3
output:
? 1 ? 2 ? 3 ? 4 ! 4
result:
ok Correct position at 4
Test #8:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
4 1 2 3 3
output:
? 1 ? 2 ? 3 ? 4 ! 4
result:
ok Correct position at 4
Test #9:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
3 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #10:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
2 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #11:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1 0
output:
? 1 ! 1
result:
ok Correct position at 1
Test #12:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
1000000 1 2 3 4 5 4 3 4 3 4 3 4 5 6 5 6 7 8 9 8 9 8 9 8 8
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500003 ? 250004 ? 125004 ? 187504 ? 156254 ? 171879 ? 164066 ? 167972 ? 169925 ? 170902 ? 170413 ? 170657 ? 170779 ? 170840 ? 170871 ? 170855 ? 170863 ? 170859 ? 170861 ? 170860 ! 170860
result:
ok Correct position at 170860
Test #13:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
999999 1 2 3 4 5 6 5 6 5 6 5 6 7 8 7 8 9 10 11 10 11 10 11 10 10
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500002 ? 750001 ? 625001 ? 687501 ? 656251 ? 671876 ? 664063 ? 667969 ? 669922 ? 670899 ? 670410 ? 670654 ? 670776 ? 670837 ? 670868 ? 670852 ? 670860 ? 670856 ? 670858 ? 670857 ! 670857
result:
ok Correct position at 670857
Test #14:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
999998 1 2 3 4 5 4 5 6 5 6 5 6 7 8 7 8 9 10 11 10 11 10 11 10 10
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500002 ? 250003 ? 375002 ? 437502 ? 406252 ? 421877 ? 414064 ? 417970 ? 419923 ? 420900 ? 420411 ? 420655 ? 420777 ? 420838 ? 420869 ? 420853 ? 420861 ? 420857 ? 420859 ? 420858 ! 420858
result:
ok Correct position at 420858
Test #15:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
999997 1 2 3 4 5 6 7 8 7 8 7 8 9 10 9 10 11 12 13 12 13 12 13 12 12
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500001 ? 749999 ? 874998 ? 937498 ? 906248 ? 921873 ? 914060 ? 917966 ? 919919 ? 920896 ? 920407 ? 920651 ? 920773 ? 920834 ? 920865 ? 920849 ? 920857 ? 920853 ? 920855 ? 920854 ! 920854
result:
ok Correct position at 920854
Test #16:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
999996 1 2 3 4 5 4 3 2 3 4 3 4 5 6 5 6 7 8 9 8 9 8 9 8 8
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500001 ? 250003 ? 125004 ? 62504 ? 93754 ? 109379 ? 101566 ? 105472 ? 107425 ? 108402 ? 107913 ? 108157 ? 108279 ? 108340 ? 108371 ? 108355 ? 108363 ? 108359 ? 108361 ? 108360 ! 108360
result:
ok Correct position at 108360
Test #17:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
999995 1 2 3 4 5 6 5 4 5 6 5 6 7 8 7 8 9 10 11 10 11 10 11 10 10
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500000 ? 749998 ? 624999 ? 562499 ? 593749 ? 609374 ? 601561 ? 605467 ? 607420 ? 608397 ? 607908 ? 608152 ? 608274 ? 608335 ? 608366 ? 608350 ? 608358 ? 608354 ? 608356 ? 608355 ! 608355
result:
ok Correct position at 608355
Test #18:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
999994 1 2 3 4 5 4 5 4 5 6 5 6 7 8 7 8 9 10 11 10 11 10 11 10 10
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500000 ? 250002 ? 375001 ? 312501 ? 343751 ? 359376 ? 351563 ? 355469 ? 357422 ? 358399 ? 357910 ? 358154 ? 358276 ? 358337 ? 358368 ? 358352 ? 358360 ? 358356 ? 358358 ? 358357 ! 358357
result:
ok Correct position at 358357
Test #19:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
999993 1 2 3 4 5 6 7 6 7 8 7 8 9 10 9 10 11 12 13 12 13 12 13 12 12
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 499999 ? 749996 ? 874995 ? 812495 ? 843745 ? 859370 ? 851557 ? 855463 ? 857416 ? 858393 ? 857904 ? 858148 ? 858270 ? 858331 ? 858362 ? 858346 ? 858354 ? 858350 ? 858352 ? 858351 ! 858351
result:
ok Correct position at 858351
Test #20:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
999992 1 2 3 4 5 4 3 4 5 6 5 6 7 8 7 8 9 10 11 10 11 10 11 10 10
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 499999 ? 250002 ? 125003 ? 187502 ? 218752 ? 234377 ? 226564 ? 230470 ? 232423 ? 233400 ? 232911 ? 233155 ? 233277 ? 233338 ? 233369 ? 233353 ? 233361 ? 233357 ? 233359 ? 233358 ! 233358
result:
ok Correct position at 233358
Test #21:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
999991 1 2 3 4 5 6 5 6 7 8 7 8 9 10 9 10 11 12 13 12 13 12 13 12 12
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 499998 ? 749995 ? 624996 ? 687495 ? 718745 ? 734370 ? 726557 ? 730463 ? 732416 ? 733393 ? 732904 ? 733148 ? 733270 ? 733331 ? 733362 ? 733346 ? 733354 ? 733350 ? 733352 ? 733351 ! 733351
result:
ok Correct position at 733351
Test #22:
score: -100
Wrong Answer
time: 1ms
memory: 3700kb
input:
1000000 1 2 3 4 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 500003 ? 250004 ? 125004 ? 62504 ? 31254 ? 15629 ? 23441 ? 27347 ? 29300 ? 30277 ? 30765 ? 31009 ? 31131 ? 31192 ? 31223 ? 31238 ? 31246 ? 31250 ? 31252 ? 31253
result:
wrong answer format Unexpected end of file - token expected