QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#498579#8819. CNOI KnowledgexinhaowenWA 28ms3584kbC++141.5kb2024-07-30 16:16:152024-07-30 16:16:16

Judging History

This is the latest submission verdict.

  • [2024-07-30 16:16:16]
  • Judged
  • Verdict: WA
  • Time: 28ms
  • Memory: 3584kb
  • [2024-07-30 16:16:15]
  • Submitted

answer

#include<cstring>
#include<cstdio>
#include<algorithm>
#include<unordered_map>
//#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,a[1004],sum[1004];unsigned long long _;
std::unordered_map<unsigned long long,int>mp;
signed main(){
	read(n);mp[1]=a[1]=last[1]=tot=1;
	for(int i=2;i<=n;++i){
		memset(sum,0,sizeof sum);
		int l=1,r=i-1,jk=0;
		for(;l<=r;){
			int mid=(l+r)>>1;
			write('?',' ',mid,' ',i,'\n');fflush(stdout);
			int tmp,op=a[mid];read(tmp);
			if(tmp-op==i-mid+1)r=mid-1;
			else jk=mid,l=mid+1;
		}
		jk?last[i]=last[jk]:last[i]=++tot;
		_=0;
		for(int j=i;j;--j)_=_*3628800+last[j],sum[mp[_]+1]++,sum[j+1]--,mp[_]=j;
		for(int j=1;j<=i;++j)sum[j]+=sum[j-1];
		for(int j=1;j<=i;++j)a[j]+=sum[j];
	}
	write('!',' ');
	for(int i=1;i<=n;++i)write(last[i],' ');
	fflush(stdout);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3584kb

input:

12
3
6
6
10
10
15
10
21
15
27
20
14
6
9
20
34
43
19
9
5
2
25
8
5
25
9
19

output:

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

result:

ok Accepted. 27 queries used.

Test #2:

score: -100
Wrong Answer
time: 28ms
memory: 3540kb

input:

1000
3
5
2
3
2
7
11
8
5
2
11
3
2
11
5
7
15
8
5
3
15
8
5
2
19
7
3
2
19
4
3
2
23
5
3
2
20
5
3
2
23
5
3
2
23
9
13
15
31
14
8
5
3
31
15
7
5
3
41
16
8
5
2
45
15
7
3
2
55
20
7
15
11
58
21
8
5
2
68
21
8
5
69
21
8
5
2
80
26
12
5
8
79
24
12
5
2
89
24
12
5
8
87
26
11
5
3
100
32
11
5
2
100
31
11
5
8
112
31
12
...

output:

? 1 2
? 1 3
? 2 3
? 2 4
? 3 4
? 2 5
? 1 5
? 3 6
? 4 6
? 5 6
? 3 7
? 5 7
? 6 7
? 4 8
? 6 8
? 5 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
? 6 13
? 9 13
? 11 13
? 12 13
? 7 14
? 10 14
? 12 14
? 13 14
? 7 15
? 11 15
? 13 15
? 14 15
?...

result:

wrong answer Wrong Answer.