QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#488789#8819. CNOI KnowledgexinhaowenWA 0ms1224kbC++141.2kb2024-07-24 15:19:372024-07-24 15:19:38

Judging History

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

  • [2024-07-24 15:19:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1224kb
  • [2024-07-24 15:19:37]
  • 提交

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;read(tmp);
			if(tmp==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;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1224kb

input:

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

output:

? 1 2
? 1 3
? 2 3
? 2 4
? 3 4
? 2 5
? 3 5
? 4 5
? 3 6
? 4 6
? 5 6
? 3 7
? 5 7
? 6 7
? 4 8
? 6 8
? 7 8
? 4 9
? 6 9
? 7 9
? 8 9
? 5 10
? 7 10
? 8 10
? 9 10
? 5 11
? 8 11
? 9 11
? 10 11
? 6 12
? 9 12
? 10 12
? 11 12
! 1 2 3 4 5 6 7 8 9 9 11 12 

result:

wrong answer Wrong Answer.