# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
112420 | 2019-05-19T16:34:07 Z | SuperJumbo | Lottery (CEOI18_lot) | C++14 | 285 ms | 760 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; y++; do{ for(int i = 0;i<n-l+1;i++) ans[y->first][i] += ans[x->first][i]; x = y++; }while(y!=ans.end()); for(auto u : queries){ for(auto v:ans[u]) printf("%d ",v); printf("\n"); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 285 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 285 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |