QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#38711#1458. Binary Search AlgorithmwyhaoWA 4ms3612kbC++447b2022-07-07 10:35:102022-07-07 10:35:11

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-07-07 10:35:11]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3612kb
  • [2022-07-07 10:35:10]
  • 提交

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