QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#136789#241. Chiaki Sequence Revisitedsalvator_noster#Compile Error//C++17857b2023-08-09 11:32:392023-08-09 11:32:39

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-09 11:32:39]
  • 评测
  • [2023-08-09 11:32:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int rd(){
	int x;
	scanf("%d",&x);
	return x;
}
int main(){
	rep(cas,1,rd()){
		int n=rd(),l=rd(),r=rd();
		rep(i,0,n-1)A[i]=rd();
		rep(i,n,2*n-1)A[i]=A[i-n]+n;
		int m=r-l;
		rep(i,0,n-1)A[i]=A[i+l%n];
		rep(i,0,n-1)rep(j,0,n-1)
			if((A[i]-A[j])%n==0)mp[i][j]=(A[j]-A[i])/n;
		rep(i,0,n-1)rep(j,0,n-1){
			if(mp[i][j]>0||mp[i][j]==0&&i<j){
				G[i].push_back((node){mp[i][j],j});
				if(~st[j]||mp[i][j]<st[j])
					st[j]=mp[i][j];
			}
		}
		rep(i,0,n-1)sort(G[i].begin(),G[i].begin());
		rep(i,0,n-1){
			if(~st[j]){
				
			}else{
				int p1=nw,p2=(int)G[i].size()-1;
				while(nw*n+i<=r){
					int tmp=r/n-(nw+G[i][p2].a)+(r%n>=G[i][p2].b);
					ans+=(A[i]+nw*n+A[i]+(nw+tmp)*n)*(tmp+1)/2*(p2+1)*(p2+1);
					nw+=tmp,p2--;
				}
			}
		}
		printf("%d",ans);
	}	
}

Details

answer.code: In function ‘int main()’:
answer.code:10:13: error: ‘cas’ was not declared in this scope; did you mean ‘cos’?
   10 |         rep(cas,1,rd()){
      |             ^~~
      |             cos
answer.code:10:9: error: ‘rep’ was not declared in this scope
   10 |         rep(cas,1,rd()){
      |         ^~~
answer.code: In function ‘int rd()’:
answer.code:6:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%d",&x);
      |         ~~~~~^~~~~~~~~