# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
15383 |
2015-07-12T06:58:19 Z |
tonyjjw |
괄호 문자열 (kriii3_R) |
C++14 |
|
89 ms |
16708 KB |
#include<stdio.h>
#define ML 1000000
#pragma warning(disable:4996)
typedef long long ll;
int p,q,mod,Q;
ll pow2[ML+1];
ll A[ML+1];
int main(){
// freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
scanf("%d%d%d%d",&p,&q,&mod,&Q);
int L;
for(L=1,pow2[0]=1%mod;L<=ML;L++){
pow2[L]=pow2[L-1]*2%mod;
}
for(A[1]=0,A[2]=2%mod,L=1;L<=ML-2;L++){
int m=L/2+1;
A[L+2]=4*A[L]+(pow2[m]-A[m])*pow2[L+2-2*m];
A[L+2]%=mod;
if(A[L+2]<0)A[L+2]+=mod;
}
for(int i=0;i<Q;i++){
scanf("%d",&L);
ll v=pow2[L]-A[L];
v%=mod;
if(v<0)v+=mod;
printf("%lld\n",v);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
77 ms |
16708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
68 ms |
16708 KB |
Output is correct |
2 |
Correct |
85 ms |
16708 KB |
Output is correct |
3 |
Correct |
75 ms |
16708 KB |
Output is correct |
4 |
Correct |
72 ms |
16708 KB |
Output is correct |
5 |
Correct |
89 ms |
16708 KB |
Output is correct |
6 |
Correct |
86 ms |
16708 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
16708 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |