# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134154 | 2019-07-22T07:27:12 Z | dragonslayerit | Lottery (CEOI18_lot) | C++14 | 690 ms | 632 KB |
#include <cstdio> #include <algorithm> int as[10001]; int ks[101]; int mismatch[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]); } for(int shift=1;shift<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]){ ans[q][i]++; ans[q][i+shift]++; } } } } for(int q=0;q<Q;q++){ for(int i=0;i<=N-L;i++){ if(i) printf(" "); printf("%d",ans[q][i]); } printf("\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 3 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 3 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 690 ms | 604 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 690 ms | 604 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 3 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |