# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
260005 | 2020-08-08T22:30:06 Z | ly20 | Lottery (CEOI18_lot) | C++17 | 107 ms | 65536 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 11234; int eq[MAXN][MAXN], resp[MAXN][MAXN]; int v[MAXN]; int main() { int n, l; scanf("%d %d", &n, &l); int id = n - l + 1; for(int i = 0; i < n; i++) { scanf("%d", &v[i]); for(int j = 0; j < i; j++) { if(v[i] != v[j]) continue; int ini1 = i - l + 1, fim1 = i, ini2 = j - l + 1, fim2 = j; int mn = min(ini1, ini2); if(mn < 0) { ini1 -= mn; ini2 -= mn; } int mx = max(fim1, fim2); eq[ini1][ini2]++; eq[ini2][ini1]++; if(fim1 + 1 < id && fim2 + 1 < id) { eq[fim1 + 1][fim2 + 1]--; eq[fim2 + 1][fim1 + 1]--; } //printf("%d %d %d %d\n", ini1, ini2, fim1, fim2); } } for(int i = 1; i < id; i++) { for(int j = 1; j < id; j++) { eq[i][j] += eq[i - 1][j - 1]; } } for(int i = 0; i < id; i++) { for(int j = 0; j < id; j++) { if(i == j) continue; //printf("%d %d %d\n", i, j, eq[i][j]); resp[i][l - eq[i][j]]++; } } for(int i = 0; i < id; i++) { for(int j = 1; j <= l; j++) { resp[i][j] += resp[i][j - 1]; } } int q; scanf("%d", &q); for(int i = 0; i < q; i++) { int r; scanf("%d", &r); for(int j = 0; j < id; j++) { printf("%d ", resp[j][r]); } printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 1024 KB | Output is correct |
3 | Correct | 1 ms | 1024 KB | Output is correct |
4 | Correct | 1 ms | 896 KB | Output is correct |
5 | Correct | 1 ms | 768 KB | Output is correct |
6 | Correct | 1 ms | 1024 KB | Output is correct |
7 | Correct | 1 ms | 1024 KB | Output is correct |
8 | Correct | 2 ms | 2176 KB | Output is correct |
9 | Correct | 2 ms | 1792 KB | Output is correct |
10 | Correct | 3 ms | 2944 KB | Output is correct |
11 | Correct | 3 ms | 2944 KB | Output is correct |
12 | Correct | 3 ms | 2816 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 1024 KB | Output is correct |
3 | Correct | 1 ms | 1024 KB | Output is correct |
4 | Correct | 1 ms | 896 KB | Output is correct |
5 | Correct | 1 ms | 768 KB | Output is correct |
6 | Correct | 1 ms | 1024 KB | Output is correct |
7 | Correct | 1 ms | 1024 KB | Output is correct |
8 | Correct | 2 ms | 2176 KB | Output is correct |
9 | Correct | 2 ms | 1792 KB | Output is correct |
10 | Correct | 3 ms | 2944 KB | Output is correct |
11 | Correct | 3 ms | 2944 KB | Output is correct |
12 | Correct | 3 ms | 2816 KB | Output is correct |
13 | Correct | 44 ms | 32248 KB | Output is correct |
14 | Correct | 31 ms | 21760 KB | Output is correct |
15 | Correct | 26 ms | 21760 KB | Output is correct |
16 | Correct | 40 ms | 28928 KB | Output is correct |
17 | Correct | 34 ms | 27008 KB | Output is correct |
18 | Correct | 38 ms | 27008 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 107 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 107 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 1024 KB | Output is correct |
3 | Correct | 1 ms | 1024 KB | Output is correct |
4 | Correct | 1 ms | 896 KB | Output is correct |
5 | Correct | 1 ms | 768 KB | Output is correct |
6 | Correct | 1 ms | 1024 KB | Output is correct |
7 | Correct | 1 ms | 1024 KB | Output is correct |
8 | Correct | 2 ms | 2176 KB | Output is correct |
9 | Correct | 2 ms | 1792 KB | Output is correct |
10 | Correct | 3 ms | 2944 KB | Output is correct |
11 | Correct | 3 ms | 2944 KB | Output is correct |
12 | Correct | 3 ms | 2816 KB | Output is correct |
13 | Correct | 44 ms | 32248 KB | Output is correct |
14 | Correct | 31 ms | 21760 KB | Output is correct |
15 | Correct | 26 ms | 21760 KB | Output is correct |
16 | Correct | 40 ms | 28928 KB | Output is correct |
17 | Correct | 34 ms | 27008 KB | Output is correct |
18 | Correct | 38 ms | 27008 KB | Output is correct |
19 | Runtime error | 107 ms | 65536 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
20 | Halted | 0 ms | 0 KB | - |