QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#38711 | #1458. Binary Search Algorithm | wyhao | WA | 4ms | 3612kb | C++ | 447b | 2022-07-07 10:35:10 | 2022-07-07 10:35:11 |
Judging History
answer
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
int n,x;
char ch[20];
set<int>S;
set<int>::iterator p;
int main(){
scanf("%d",&n);
for(int ii=1;ii<=2*n;ii++){
scanf("%s%d",ch,&x);
if(ch[0]=='a') S.insert(x);
else S.erase(x);
if(!S.empty()){
p=S.begin();
cout<<"1 "<<*p<<endl;
scanf("%d",&x);
cout<<x<<endl;
}else{
cout<<"0"<<endl;
cout<<"-1"<<endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 4ms
memory: 3612kb
input:
3 add 1 1 add 3 1 delete 1 3 add 2 2 delete 3 2 delete 2
output:
1 1 1 1 1 1 1 3 3 1 2 2 1 2 2 0 -1
result:
wrong answer WA after query 2 found 1, answer is 3