QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#488723#8819. CNOI Knowledgesumi007WA 1ms3672kbC++23670b2024-07-24 14:39:052024-07-24 14:39:06

Judging History

This is the latest submission verdict.

  • [2024-07-24 14:39:06]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3672kb
  • [2024-07-24 14:39:05]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int N = 2077;
int n,s[N],cnt;
int ask(int l,int r){
	int res = 0;
	cout <<"? " << l << ' ' << r << "\n",cout.flush();
	cin >> res;
	return res;
}
int main(){
	cin.tie(0),cout.tie(0);
	ios::sync_with_stdio(0); 
	cin >> n;
	for(int i=1;i<=n;i++){
		int l = 1,r = i-1,las = i-1;
		while(l<=r){
			int mid = (l+r)>>1;
			if(ask(mid,i-1)*2+1==ask(mid,i)){
				las = mid-1;
				r = mid-1;
			}else{
				l = mid+1;
			}
		}
		if(las == 0) s[i] = ++cnt;
		else s[i] = s[las];
	}
	cout << "! ";
	for(int i=1;i<=n;i++) cout << s[i] << ' ';
	return 0;
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3672kb

input:

12
1
3
3
6
1
3
3
6
1
3
6
10
3
6
1
3
6
10
3
6
1
3
10
15
3
6
1
3
10
14
3
6
1
3
14
20
6
10
3
6
1
3
14
19
6
9
3
5
1
2
19
25
5
8
2
5
19
25
5
9
3
6
1
3

output:

? 1 1
? 1 2
? 1 2
? 1 3
? 2 2
? 2 3
? 2 3
? 2 4
? 3 3
? 3 4
? 2 4
? 2 5
? 3 4
? 3 5
? 4 4
? 4 5
? 3 5
? 3 6
? 4 5
? 4 6
? 5 5
? 5 6
? 3 6
? 3 7
? 5 6
? 5 7
? 6 6
? 6 7
? 4 7
? 4 8
? 6 7
? 6 8
? 7 7
? 7 8
? 4 8
? 4 9
? 6 8
? 6 9
? 7 8
? 7 9
? 8 8
? 8 9
? 5 9
? 5 10
? 7 9
? 7 10
? 8 9
? 8 10
? 9 9
? 9...

result:

wrong answer Wrong Answer.