# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112421 | 2019-05-19T16:36:07 Z | SuperJumbo | Lottery (CEOI18_lot) | C++14 | 296 ms | 776 KB |
#include<bits/stdc++.h> using namespace std; int main(){ int n,l; scanf("%d %d",&n,&l); vector<int> a(n); for(int i = 0;i<n;i++)scanf("%d",&a[i]); int q;scanf("%d",&q); vector<int> queries; map<int,vector<int>> ans; for(int i = 0;i<q;i++){ int x;scanf("%d",&x); queries.push_back(x); ans[x] = vector<int> (n-l+1,0); } vector<int> v(n); vector<int> sum(n,0); for(int i = 0;i<n;i++){ int u = i - l; if(i>=l){ for(int j = u+1,x = 0;j<n;x++,j++) sum[x]-=(a[u] != a[j]); } for(int j = i+1,x = 0;j<n;x++,j++){ sum[x]+=(a[i] != a[j]); if(i>=l-1){ auto y = ans.lower_bound(sum[x]); if(y == ans.end())continue; ans[y->first][u+1]++; ans[y->first][u+2+x]++; } } } auto x = ans.begin(),y=x; advance(y,1); do{ for(int i = 0;i<n-l+1;i++) ans[y->first][i] += ans[x->first][i]; x = y; advance(y,1); }while(y!=ans.end()); for(auto u : queries){ for(auto v:ans[u]) printf("%d ",v); printf("\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 512 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 | 2 ms | 512 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 | 296 ms | 776 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 | 296 ms | 776 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 | 2 ms | 512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |