QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#488797 | #8819. CNOI Knowledge | xinhaowen | WA | 0ms | 1240kb | C++14 | 1.3kb | 2024-07-24 15:23:01 | 2024-07-24 15:23:02 |
Judging History
answer
#include<cstdio>
#include<algorithm>
//#define getchar getchar_unlocked
//#define putchar putchar_unlocked
template<typename T>void read(T &x){
x=0;bool f=0;char ch=getchar();
for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=1;
for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<1)+(x<<3)+(ch^48);
if(f)x=-x;
}
void write(char x){putchar(x);}
template<typename T>void write(T x){
if(x<0)putchar('-'),x=-x;
char stk[24];int cnt=0;
do stk[++cnt]=x%10+48,x/=10;while(x);
for(;cnt;)putchar(stk[cnt--]);
}
template<typename T,typename ...Args>void read(T &x,Args &...args){read(x);read(args...);}
template<typename T,typename ...Args>void write(T x,Args ...args){write(x);write(args...);}
template<typename T>T min(T x,T y){return x<y?x:y;}
template<typename T>T max(T x,T y){return x>y?x:y;}
int n,last[1004],tot;
signed main(){
read(n);
for(int i=1;i<=n;++i){
int l=1,r=i-1,ans=0;
for(;l<=r;){
int mid=(l+r)>>1;
write('?',' ',mid,' ',i,'\n');fflush(stdout);
int tmp,op;read(tmp);
write('?',' ',mid,' ',i-1,'\n');fflush(stdout);
read(op);
if(tmp-op==i-mid+1)r=mid-1;
else ans=mid,l=mid+1;
}
last[i]=ans+1;
}
write('!',' ');
for(int i=1;i<=n;++i)
if(!last[i])write(last[i]=++tot,' ');
else write(last[i]=last[last[i]],' ');
fflush(stdout);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1240kb
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:
wrong answer Wrong Answer.