QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#378439 | #6394. Turn on the Light | 1677118046# | WA | 1ms | 3704kb | C++17 | 651b | 2024-04-06 13:01:50 | 2024-04-06 13:01:50 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void query(int x){
cout<<"?"<<" "<<x<<endl;
}
void solve(){
int n;cin>>n;
ll num=0;
for(int i=1;i<=20;i++){
query(i);
ll x;cin>>x;
if(x==num){
cout<<"!"<<" "<<i<<endl;
return;
}else{
num=x;
}
}
int l=21,r=n;
while(l<=r){
ll mid=(l+r)/2;
query(mid);
ll x;cin>>x;
if(x==mid){
cout<<"!"<<" "<<mid<<endl;
return;
}else{
if(x>num){
num=x;
l=mid+1;
}else{
num=x;
r=mid-1;
}
}
}
}
int main(){
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
solve();
}
/*
1
514 2 10
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
3 1 2 2
output:
? 1 ? 2 ? 3 ! 3
result:
ok Correct position at 3
Test #2:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
10 1 2 3 4 5 6 7 8 8
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ? 9 ! 9
result:
ok Correct position at 9
Test #3:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
9 1 2 3 4 5 6 7 7
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ! 8
result:
ok Correct position at 8
Test #4:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
8 1 2 3 4 5 6 6
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ! 7
result:
ok Correct position at 7
Test #5:
score: 0
Accepted
time: 0ms
memory: 3548kb
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: 1ms
memory: 3584kb
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: 3636kb
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: 3596kb
input:
4 1 2 3 3
output:
? 1 ? 2 ? 3 ? 4 ! 4
result:
ok Correct position at 4
Test #9:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
3 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #10:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
2 1 1
output:
? 1 ? 2 ! 2
result:
ok Correct position at 2
Test #11:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
1 0
output:
? 1 ! 1
result:
ok Correct position at 1
Test #12:
score: -100
Wrong Answer
time: 0ms
memory: 3600kb
input:
1000000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 22 23 24 25 26 27 28 29 30 31 32 31 32 31 32 33 33
output:
? 1 ? 2 ? 3 ? 4 ? 5 ? 6 ? 7 ? 8 ? 9 ? 10 ? 11 ? 12 ? 13 ? 14 ? 15 ? 16 ? 17 ? 18 ? 19 ? 20 ? 500010 ? 750005 ? 875003 ? 937502 ? 906252 ? 921877 ? 929689 ? 933595 ? 935548 ? 936525 ? 937013 ? 937257 ? 937379 ? 937440 ? 937471 ? 937455 ? 937463 ? 937459 ? 937461 ? 937462
result:
wrong answer format Unexpected end of file - token expected