# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112403 | 2019-05-19T15:34:38 Z | SuperJumbo | Lottery (CEOI18_lot) | C++14 | 3000 ms | 632 KB |
#include<bits/stdc++.h> #pragma comment(linker, "/stack:200000000") #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") 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[l-x] = vector<int> (n-l+1,1); } vector<int> v(n); vector<int> sum(n,0),first(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){ for(auto y:ans){ if(l-y.first<sum[x])break; ans[y.first][u+1]++; ans[y.first][u+2+x]++; } } } } for(auto u : queries){ for(auto v:ans[l-u]) printf("%d ",v-1); printf("\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 10 ms | 356 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 10 ms | 356 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
13 | Correct | 810 ms | 504 KB | Output is correct |
14 | Correct | 240 ms | 632 KB | Output is correct |
15 | Correct | 132 ms | 504 KB | Output is correct |
16 | Correct | 405 ms | 632 KB | Output is correct |
17 | Correct | 230 ms | 632 KB | Output is correct |
18 | Correct | 197 ms | 524 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3088 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3088 ms | 512 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 3 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 3 ms | 256 KB | Output is correct |
8 | Correct | 6 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 10 ms | 356 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 7 ms | 384 KB | Output is correct |
13 | Correct | 810 ms | 504 KB | Output is correct |
14 | Correct | 240 ms | 632 KB | Output is correct |
15 | Correct | 132 ms | 504 KB | Output is correct |
16 | Correct | 405 ms | 632 KB | Output is correct |
17 | Correct | 230 ms | 632 KB | Output is correct |
18 | Correct | 197 ms | 524 KB | Output is correct |
19 | Execution timed out | 3088 ms | 512 KB | Time limit exceeded |
20 | Halted | 0 ms | 0 KB | - |