QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#488725 | #8819. CNOI Knowledge | maojun | WA | 11ms | 3944kb | C++23 | 450b | 2024-07-24 14:39:32 | 2024-07-24 14:39:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1005;
int n,s[N];
inline int qry(int l,int r){
printf("? %d %d\n",l,r);fflush(stdout);
int x;scanf("%d",&x);return x;
}
int main(){
scanf("%d",&n);
for(int i=1,j=0;i<=n;i++){
int l=0,r=i-1,mid;
while(l<r)qry(mid=l+r+1>>1,i)-qry(mid,i-1)^i-mid+1?l=mid:r=mid-1;
s[i]=!l?++j:s[l];
}
printf("!");for(int i=1;i<=n;i++)printf(" %d",s[i]);fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3884kb
input:
12 3 1 6 3 6 3 10 6 10 6 15 10 10 6 21 15 15 10 27 21 20 15 14 10 6 3 9 6 20 14 34 26 43 34 19 14 9 6 5 3 2 1 25 19 8 5 5 2 25 19 9 5 19 13
output:
? 1 2 ? 1 1 ? 1 3 ? 1 2 ? 2 4 ? 2 3 ? 1 4 ? 1 3 ? 2 5 ? 2 4 ? 1 5 ? 1 4 ? 3 6 ? 3 5 ? 1 6 ? 1 5 ? 3 7 ? 3 6 ? 1 7 ? 1 6 ? 2 7 ? 2 6 ? 4 8 ? 4 7 ? 6 8 ? 6 7 ? 5 8 ? 5 7 ? 4 9 ? 4 8 ? 2 9 ? 2 8 ? 1 9 ? 1 8 ? 5 10 ? 5 9 ? 7 10 ? 7 9 ? 8 10 ? 8 9 ? 9 10 ? 9 9 ? 5 11 ? 5 10 ? 8 11 ? 8 10 ? 9 11 ? 9 10 ? ...
result:
ok Accepted. 54 queries used.
Test #2:
score: -100
Wrong Answer
time: 11ms
memory: 3944kb
input:
1000 3 1 5 3 2 1 3 2 2 1 7 3 11 7 8 5 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