QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#404203#6810. Array ConcatenationjiajieshiWA 11ms9072kbC++201.7kb2024-05-03 16:00:342024-05-03 16:00:35

Judging History

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

  • [2024-05-03 16:00:35]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:9072kb
  • [2024-05-03 16:00:34]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std ;
#define int long long
#define cer2(a,b) cerr<<#a<<'='<<(a)<<','<<#b<<'='<<(b)<<"@ line"<<__LINE__<<endl
#define cer(a) cerr<<#a<<'='<<(a)<<"@ line"<<__LINE__<<endl
#define ull unsigned long long
#define ll long long
const int N = 4e5+100, mod=1e9+7;
ll a[N] ,n ,m ,s1[N] ,s2[N];
ll b1[N],b2[N],tot; 
signed main(){
 	#ifndef ONLINE_JUDGE
		freopen("C:\\Users\\JIAJIEASHI\\Desktop\\in.cpp","r",stdin);
	//	freopen("out.cpp","w",stdout);
	#endif
    ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
 	cin>>n>>m ;
 	int m1=0, m2=0; 
 	for(int i=1;i<=n;i++) cin>>a[i] ,s1[i]=s1[i-1]+a[i],m1+=s1[i];
 	for(int i=n;i>0;i--) s2[i] =s2[i+1] +a[i],m2+=s2[i];
// 	cer2(m1,m2);
 	int t =0 ,S=0 ;
 	
 		for(int i=1;i<=n;i++) b1[++tot] = a[i] ;
 		for(int i=1;i<=n;i++) b1[++tot] =a[i] ;
// 		cer(tot);
 		for(int i=1;i<=tot;i++) b1[i]+=b1[i-1] ;
	    
	    tot=0;
	    int SL;
		for(int i=n;i>0;i--) b2[++tot] =a[i] ;
		for(int i=1;i<=n;i++) b2[++tot] =a[i] ;
		for(int i=1;i<=tot;i++) b2[i]+=b2[i-1];
//		cer2(m1,m2);
	    if(m1>=m2)//  ·ÅÔÚÇ°Ãæ 
	    {
	    	for(int i=1;i<=tot;i++)
	    	{
	    		S+=b1[i];
	    		S%=mod;
			}
	    	SL=b1[n]*2;
		}else{//·ÅÔÚºóÃæ 
			for(int i=1;i<=tot;i++)
			{
				S+=b2[i];
				S%=mod;
			}
			SL=b2[n]*2;
		}
//	for(int i=1;i<=tot;i++) cout << b[i] <<' '; cout<<endl; 
	
	
//	for(int i=1;i<=tot;i++)
//		tmp+=b[i],tmp%=mod ;
//	cout <<tmp <<endl;
//	for(int i=1;i<=tot;i++) cout <<b[i] <<' '; cout<<endl; 
//	cout <<S%=mod;
//    cer(S);
	int L = 2*n%mod ;
	S%=mod;
 	for(int i=1;i<=m-1;i++,L*=2){
// 		S*=(L+2),S%=mod ;
        L%=mod;
 		S=2*S%mod+L*SL%mod;
 		S%=mod;
 		SL*=2;
 		SL%=mod;
	 }
	 cout <<S <<endl;
 }

詳細信息

Test #1:

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

input:

2 1
1 2

output:

15

result:

ok single line: '15'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

5 10
26463 39326 86411 75307 85926

output:

806275469

result:

ok single line: '806275469'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

3 10000
329770536 859936159 696111818

output:

325223749

result:

ok single line: '325223749'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3608kb

input:

10 100000
910385778 832405357 79882277 740539785 58009121 361679935 208356273 191444931 327043571 40502864

output:

551220212

result:

ok single line: '551220212'

Test #5:

score: -100
Wrong Answer
time: 11ms
memory: 9072kb

input:

99998 99999
424541359 970848132 124944765 190568793 218987145 439687684 674898132 26756266 495705287 999481800 123311748 808192729 480063991 282558300 432664601 480692564 771223766 592954167 648647039 80490877 501738111 3075724 426165921 557518328 209501102 786985447 129062653 705971029 763019010 16...

output:

882136703

result:

wrong answer 1st lines differ - expected: '371554090', found: '882136703'