QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#488799#8819. CNOI KnowledgeczcCompile Error//C++14989b2024-07-24 15:26:022024-07-24 15:26:04

Judging History

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

  • [2024-07-24 15:26:04]
  • 评测
  • [2024-07-24 15:26:02]
  • 提交

answer

#include<bits/stdc++.h>
#define ull unsigned long long
const ull p=131;
using namespace std;
int n;
inline int ask(int l,int r){
	cout<<"? "<<l<<" "<<r<<endl;
	int x; cin>>x;
	return x;
}
unordered_map<ull,int> mp;
const int maxn=1e3+5;
int s[maxn],cnt[maxn],tot;
ull h[maxn],pw[maxn];
inline int get(int l,int r){
	int ret=0;
	for(int i=l;i<=r;i++) ret+=cnt[i];
	return ret;
}
int main(){
	cin>>n;
	pw[0]=1;
	for(int i=1;i<=n;i++) pw[i]=pw[i-1]*p;
	for(int i=1;i<=n;i++){
		if(i==1 || get(1,i-1)+i==ask(1,i)){
			s[i]=++tot;
		}
		else{
			int l=2,r=i;
			while(l<r){
				int mid=(l+r)>>1;
				if(aks(mid,i-1)+(i-mid+1)==ask(mid,i)) r=mid;
				else l=mid+1;
			}
			s[i]=s[l-1];
		}
		h[i]=h[i-1]*p+(ull)s[i];
		for(int j=1;j<=i;j++){
			if(!mp[h[i]-h[j-1]*pw[i-j+1]]){
				mp[h[i]-h[j-1]*pw[i-j+1]]=1;
				cnt[j]++;
			}
		}
	}
	cout<<"! ";
	for(int i=1;i<=n;i++) cout<<s[i]<<" ";
	cout<<endl;
	return 0;
}
/*
1 2 3 4 5 6 2 5 7 7 2 6
*/

详细

answer.code: In function ‘int main()’:
answer.code:32:36: error: ‘aks’ was not declared in this scope; did you mean ‘ask’?
   32 |                                 if(aks(mid,i-1)+(i-mid+1)==ask(mid,i)) r=mid;
      |                                    ^~~
      |                                    ask