Submission #2228701
Source Code Expand
#include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<ctime> #include<cstdlib> #define cmax(a,b) (a<(b)?a=(b),1:0) #define cmin(a,b) (a>(b)?a=(b),1:0) #define dmin(a,b) ((a)<(b)?(a):(b)) #define dmax(a,b) ((a)>(b)?(a):(b)) #define CL fclose(stdin),fclose(stdout) namespace io { int F() { int n=0,F=1; char ch; while((ch=getchar())!='-'&&(ch<'0'||ch>'9')); ch=='-'?F=0:n=ch-'0'; while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0'; return F?n:-n; } long long G() { long long n=0,F=1; char ch; while((ch=getchar())!='-'&&(ch<'0'||ch>'9')); ch=='-'?F=0:n=ch-'0'; while((ch=getchar())>='0'&&ch<='9')n=(n<<1)+(n<<3)+ch-'0'; return F?n:-n; } } char s[5555]; const int M=1000000007; int f[5005][5005]; int g[5005][5005]; int h[5005]; int main() { int n=io::F(); scanf("%s",s+1); int m=strlen(s+1); g[1][1]=2; for(register int i=1;i<5000;++i) for(register int j=0;j<=5000;++j) g[i+1][j+1]=(g[i+1][j+1]+2ll*g[i][j])%M,g[i+1][j?j-1:0]=(g[i+1][j?j-1:0]+g[i][j])%M; h[0]=1; for(register int i=1;i<=5000;++i) h[i]=g[i][0]; f[1][1]=1; for(register int i=1;i<5000;++i) for(register int j=1;j<=5000;++j) f[i+1][j+1]=(f[i+1][j+1]+f[i][j])%M,f[i+1][j-1]=(f[i+1][j-1]+2ll*f[i][j])%M; int ans=0; for(register int k=0;k<n;++k) ans=(ans+(long long)h[k]*f[n-k][m])%M; printf("%d\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Unhappy Hacking |
User | ESpace |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1427 Byte |
Status | WA |
Exec Time | 206 ms |
Memory | 195840 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:41:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s",s+1); ^
Judge Result
Set Name | Sample | Sub1 | Sub2 | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | 0 / 400 | ||||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 0_01, 0_02, 0_03 |
Sub1 | 0_01, 0_02, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12, 1_13, 1_14, 1_15, 1_16, 1_17, 1_18, 1_19, 1_20, 1_21, 1_22, 1_23, 1_24 |
Sub2 | 0_01, 0_02, 0_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12, 1_13, 1_14, 1_15, 1_16, 1_17, 1_18, 1_19, 1_20, 1_21, 1_22, 1_23, 1_24, 2_25, 2_26, 2_27, 2_28, 2_29, 2_30, 2_31, 2_32, 2_33, 2_34, 2_35, 2_36, 2_37, 2_38, 2_39, 2_40, 2_41, 2_42, 2_43, 2_44 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_01 | WA | 205 ms | 195712 KB |
0_02 | WA | 205 ms | 195712 KB |
0_03 | WA | 206 ms | 195712 KB |
1_04 | AC | 205 ms | 195840 KB |
1_05 | WA | 205 ms | 195712 KB |
1_06 | WA | 205 ms | 195712 KB |
1_07 | WA | 205 ms | 195712 KB |
1_08 | WA | 205 ms | 195712 KB |
1_09 | AC | 205 ms | 195840 KB |
1_10 | WA | 205 ms | 195712 KB |
1_11 | WA | 205 ms | 195840 KB |
1_12 | WA | 205 ms | 195712 KB |
1_13 | WA | 205 ms | 195840 KB |
1_14 | WA | 205 ms | 195840 KB |
1_15 | WA | 205 ms | 195840 KB |
1_16 | WA | 205 ms | 195840 KB |
1_17 | WA | 205 ms | 195712 KB |
1_18 | WA | 205 ms | 195712 KB |
1_19 | WA | 205 ms | 195712 KB |
1_20 | WA | 205 ms | 195712 KB |
1_21 | WA | 205 ms | 195840 KB |
1_22 | WA | 205 ms | 195840 KB |
1_23 | WA | 205 ms | 195840 KB |
1_24 | WA | 205 ms | 195712 KB |
2_25 | WA | 205 ms | 195712 KB |
2_26 | WA | 205 ms | 195712 KB |
2_27 | WA | 205 ms | 195840 KB |
2_28 | WA | 205 ms | 195840 KB |
2_29 | AC | 205 ms | 195840 KB |
2_30 | WA | 205 ms | 195840 KB |
2_31 | WA | 205 ms | 195840 KB |
2_32 | WA | 205 ms | 195840 KB |
2_33 | WA | 205 ms | 195840 KB |
2_34 | WA | 205 ms | 195840 KB |
2_35 | WA | 205 ms | 195840 KB |
2_36 | WA | 205 ms | 195840 KB |
2_37 | WA | 205 ms | 195840 KB |
2_38 | WA | 205 ms | 195840 KB |
2_39 | WA | 205 ms | 195712 KB |
2_40 | WA | 205 ms | 195840 KB |
2_41 | WA | 205 ms | 195840 KB |
2_42 | WA | 205 ms | 195840 KB |
2_43 | WA | 205 ms | 195712 KB |
2_44 | WA | 205 ms | 195712 KB |