Submission #1678172
Source Code Expand
#include <cstdio> #include <cstring> #include <algorithm> #define MAXN 110 #define LL long long using namespace std; const LL P=1000000007; int n,n2; int a[MAXN]; int next_v[MAXN],prev_v[MAXN]; LL f[MAXN][MAXN][MAXN][2]; inline void update(LL &x,LL y){ x=(x+y)%P; } int main(){ #ifdef DEBUG freopen("F.in","r",stdin); #endif scanf("%d",&n); n2=n*2-1; for(int i=1;i<=n2;i++) scanf("%d",a+i); sort(a+1,a+n2+1); for(int i=2;i<=n2;i++) if(a[i-1]!=a[i]){ next_v[a[i-1]]=a[i]; prev_v[a[i]]=a[i-1]; } prev_v[a[1]]=-1; next_v[a[n2]]=n2+1; f[0][a[1]][a[n2]][0]=1; for(int i=0;i<n;i++){ int lpos=i+1,rpos=n2-i; for(int j=a[1];j<=a[n2];j=next_v[j]) for(int k=j;k<=a[n2];k=next_v[k]){ if(f[i][j][k][0]){ for(int l=j;l<=k;l=next_v[l]) if(l>=a[lpos] && l<=a[rpos]){ update(f[i+1][j][l][0],f[i][j][k][0]); update(f[i+1][l][k][1],f[i][j][k][0]); } } if(f[i][j][k][1]){ for(int l=j;l<=k;l=next_v[l]) if(l>=a[lpos] && l<=a[rpos]){ if(l==j){ update(f[i+1][l][k][1],f[i][j][k][1]); }else{ update(f[i+1][j][l][0],f[i][j][k][1]); update(f[i+1][l][k][1],f[i][j][k][1]); } } } } } LL ans=0; for(int i=1;i<=n2;i++) for(int j=1;j<=n2;j++) update(ans,f[n][i][j][0]); printf("%lld\n",ans); return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Prefix Median |
User | ez_zjt |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1392 Byte |
Status | WA |
Exec Time | 37 ms |
Memory | 9984 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:21:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:23:40: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] for(int i=1;i<=n2;i++) scanf("%d",a+i); ^
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 2000 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt |
All | 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 1 ms | 128 KB |
00_example_02.txt | AC | 1 ms | 256 KB |
00_example_03.txt | WA | 1 ms | 2560 KB |
01.txt | WA | 37 ms | 9984 KB |
02.txt | WA | 27 ms | 9856 KB |
03.txt | WA | 6 ms | 5248 KB |
04.txt | WA | 3 ms | 4992 KB |
05.txt | WA | 2 ms | 2816 KB |
06.txt | WA | 14 ms | 7552 KB |
07.txt | WA | 37 ms | 9984 KB |
08.txt | WA | 2 ms | 2816 KB |
09.txt | WA | 37 ms | 9984 KB |
10.txt | WA | 1 ms | 256 KB |
11.txt | WA | 1 ms | 2560 KB |
12.txt | WA | 2 ms | 2688 KB |
13.txt | WA | 11 ms | 7424 KB |
14.txt | WA | 18 ms | 7680 KB |
15.txt | WA | 1 ms | 256 KB |
16.txt | WA | 12 ms | 9856 KB |
17.txt | WA | 1 ms | 2432 KB |
18.txt | AC | 1 ms | 128 KB |
19.txt | AC | 1 ms | 128 KB |
20.txt | WA | 1 ms | 2560 KB |
21.txt | WA | 1 ms | 2560 KB |
22.txt | WA | 1 ms | 256 KB |
23.txt | WA | 3 ms | 4992 KB |
24.txt | WA | 1 ms | 2688 KB |
25.txt | WA | 3 ms | 5120 KB |
26.txt | WA | 4 ms | 5120 KB |
27.txt | WA | 1 ms | 2688 KB |
28.txt | WA | 12 ms | 9856 KB |
29.txt | WA | 2 ms | 4864 KB |
30.txt | WA | 3 ms | 5120 KB |
31.txt | WA | 1 ms | 256 KB |
32.txt | WA | 3 ms | 4992 KB |
33.txt | WA | 1 ms | 256 KB |
34.txt | WA | 3 ms | 4992 KB |
35.txt | WA | 7 ms | 9600 KB |
36.txt | AC | 1 ms | 128 KB |
37.txt | WA | 10 ms | 9728 KB |
38.txt | WA | 3 ms | 5120 KB |
39.txt | WA | 3 ms | 4992 KB |
40.txt | WA | 1 ms | 2688 KB |
41.txt | WA | 6 ms | 7424 KB |
42.txt | WA | 14 ms | 9984 KB |
43.txt | WA | 2 ms | 2816 KB |
44.txt | WA | 14 ms | 9984 KB |
45.txt | WA | 1 ms | 256 KB |
46.txt | WA | 1 ms | 2432 KB |
47.txt | WA | 2 ms | 2688 KB |
48.txt | WA | 5 ms | 7296 KB |
49.txt | WA | 7 ms | 7552 KB |
50.txt | WA | 1 ms | 256 KB |
51.txt | AC | 3 ms | 8448 KB |