# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134170 | 2019-07-22T07:42:17 Z | dragonslayerit | Lottery (CEOI18_lot) | C++14 | 991 ms | 8184 KB |
#include <cstdio> #include <algorithm> int as[10001]; std::pair<int,int> ks[101]; int mismatch[10001]; int down[10001]; int ans[100][10001]; int main(){ int N,L; scanf("%d %d",&N,&L); for(int i=0;i<N;i++){ scanf("%d",&as[i]); } int Q; scanf("%d",&Q); for(int i=0;i<Q;i++){ scanf("%d",&ks[i].first); ks[i].second=i; } std::sort(ks,ks+Q); ks[Q].first=10001; for(int x=0;x<=10000;x++){ for(int q=0;q<=Q;q++){ if(x<=ks[q].first){ down[x]=q; break; } } } for(int shift=1;shift+L<=N;shift++){ std::fill(mismatch,mismatch+N-L-shift+1,0); for(int i=0;i+shift<N;i++){ if(as[i]!=as[i+shift]){ mismatch[std::max(0,i-L+1)]++; mismatch[std::min(i,N-L-shift)+1]--; } } for(int i=1;i<=N-L-shift;i++){ mismatch[i]+=mismatch[i-1]; } /* for(int q=0;q<Q;q++){ for(int i=0;i<=N-L-shift;i++){ //printf("[%d,%d] and [%d,%d]: %d\n",i,i+L-1,i+shift,i+shift+L-1,mismatch[i]); if(mismatch[i]<=ks[q].first){ ans[q][i]++; ans[q][i+shift]++; } } } */ for(int i=0;i<=N-L-shift;i++){ ans[down[mismatch[i]]][i]++; ans[down[mismatch[i]]][i+shift]++; } } for(int q=1;q<Q;q++){ for(int i=0;i<=N-L;i++){ ans[q][i]+=ans[q-1][i]; } } for(int q=0;q<Q;q++){ for(int k=0;k<Q;k++){ if(ks[k].second==q){ for(int i=0;i<=N-L;i++){ if(i) printf(" "); printf("%d",ans[k][i]); } printf("\n"); break; } } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 4 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 4 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 32 ms | 504 KB | Output is correct |
14 | Correct | 19 ms | 632 KB | Output is correct |
15 | Correct | 18 ms | 552 KB | Output is correct |
16 | Correct | 28 ms | 632 KB | Output is correct |
17 | Correct | 26 ms | 632 KB | Output is correct |
18 | Correct | 26 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 873 ms | 632 KB | Output is correct |
2 | Correct | 867 ms | 632 KB | Output is correct |
3 | Correct | 702 ms | 632 KB | Output is correct |
4 | Correct | 617 ms | 632 KB | Output is correct |
5 | Correct | 198 ms | 504 KB | Output is correct |
6 | Correct | 570 ms | 772 KB | Output is correct |
7 | Correct | 164 ms | 504 KB | Output is correct |
8 | Correct | 296 ms | 484 KB | Output is correct |
9 | Correct | 602 ms | 636 KB | Output is correct |
10 | Correct | 615 ms | 632 KB | Output is correct |
11 | Correct | 32 ms | 376 KB | Output is correct |
12 | Correct | 348 ms | 604 KB | Output is correct |
13 | Correct | 289 ms | 504 KB | Output is correct |
14 | Correct | 282 ms | 520 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 873 ms | 632 KB | Output is correct |
2 | Correct | 867 ms | 632 KB | Output is correct |
3 | Correct | 702 ms | 632 KB | Output is correct |
4 | Correct | 617 ms | 632 KB | Output is correct |
5 | Correct | 198 ms | 504 KB | Output is correct |
6 | Correct | 570 ms | 772 KB | Output is correct |
7 | Correct | 164 ms | 504 KB | Output is correct |
8 | Correct | 296 ms | 484 KB | Output is correct |
9 | Correct | 602 ms | 636 KB | Output is correct |
10 | Correct | 615 ms | 632 KB | Output is correct |
11 | Correct | 32 ms | 376 KB | Output is correct |
12 | Correct | 348 ms | 604 KB | Output is correct |
13 | Correct | 289 ms | 504 KB | Output is correct |
14 | Correct | 282 ms | 520 KB | Output is correct |
15 | Correct | 678 ms | 632 KB | Output is correct |
16 | Correct | 541 ms | 508 KB | Output is correct |
17 | Correct | 640 ms | 632 KB | Output is correct |
18 | Correct | 626 ms | 504 KB | Output is correct |
19 | Correct | 627 ms | 556 KB | Output is correct |
20 | Correct | 638 ms | 632 KB | Output is correct |
21 | Correct | 628 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 504 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 3 ms | 376 KB | Output is correct |
9 | Correct | 3 ms | 376 KB | Output is correct |
10 | Correct | 3 ms | 504 KB | Output is correct |
11 | Correct | 4 ms | 504 KB | Output is correct |
12 | Correct | 3 ms | 504 KB | Output is correct |
13 | Correct | 32 ms | 504 KB | Output is correct |
14 | Correct | 19 ms | 632 KB | Output is correct |
15 | Correct | 18 ms | 552 KB | Output is correct |
16 | Correct | 28 ms | 632 KB | Output is correct |
17 | Correct | 26 ms | 632 KB | Output is correct |
18 | Correct | 26 ms | 632 KB | Output is correct |
19 | Correct | 873 ms | 632 KB | Output is correct |
20 | Correct | 867 ms | 632 KB | Output is correct |
21 | Correct | 702 ms | 632 KB | Output is correct |
22 | Correct | 617 ms | 632 KB | Output is correct |
23 | Correct | 198 ms | 504 KB | Output is correct |
24 | Correct | 570 ms | 772 KB | Output is correct |
25 | Correct | 164 ms | 504 KB | Output is correct |
26 | Correct | 296 ms | 484 KB | Output is correct |
27 | Correct | 602 ms | 636 KB | Output is correct |
28 | Correct | 615 ms | 632 KB | Output is correct |
29 | Correct | 32 ms | 376 KB | Output is correct |
30 | Correct | 348 ms | 604 KB | Output is correct |
31 | Correct | 289 ms | 504 KB | Output is correct |
32 | Correct | 282 ms | 520 KB | Output is correct |
33 | Correct | 678 ms | 632 KB | Output is correct |
34 | Correct | 541 ms | 508 KB | Output is correct |
35 | Correct | 640 ms | 632 KB | Output is correct |
36 | Correct | 626 ms | 504 KB | Output is correct |
37 | Correct | 627 ms | 556 KB | Output is correct |
38 | Correct | 638 ms | 632 KB | Output is correct |
39 | Correct | 628 ms | 504 KB | Output is correct |
40 | Correct | 883 ms | 1968 KB | Output is correct |
41 | Correct | 35 ms | 632 KB | Output is correct |
42 | Correct | 649 ms | 2168 KB | Output is correct |
43 | Correct | 616 ms | 1820 KB | Output is correct |
44 | Correct | 616 ms | 1784 KB | Output is correct |
45 | Correct | 991 ms | 8184 KB | Output is correct |
46 | Runtime error | 9 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
47 | Halted | 0 ms | 0 KB | - |