# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
259911 | 2020-08-08T19:29:59 Z | peuch | Lottery (CEOI18_lot) | C++17 | 605 ms | 32120 KB |
#include<bits/stdc++.h> using namespace std; const int MAXN = 2010; int n, l, q; int v[MAXN]; int intr[MAXN][MAXN]; map<int, vector<int> > marc; int eql[MAXN][MAXN]; int ans[MAXN][MAXN]; int main(){ scanf("%d %d", &n, &l); for(int i = 1; i <= n; i++) scanf("%d", &v[i]); for(int i = 1; i <= n - l + 1; i++) for(int j = 0; j < l; j++) intr[i][j + 1] = v[i + j]; for(int i = 1; i <= l; i++){ marc.clear(); for(int j = 1; j <= n - l + 1; j++) marc[intr[j][i]].push_back(j); for(int j = 1; j <= n - l + 1; j++) for(int k = 0; k < marc[intr[j][i]].size(); k++) eql[j][marc[intr[j][i]][k]]++; } for(int i = 1; i <= n - l + 1; i++) for(int j = 1; j <= n - l + 1; j++){ if(j == i) continue; ans[i][l - eql[i][j]]++; } for(int i = 1; i <= n - l + 1; i++) for(int j = 1; j <= l; j++) ans[i][j] += ans[i][j - 1]; scanf("%d", &q); for(int i = 1; i <= q; i++){ int k; scanf("%d", &k); for(int i = 1; i <= n - l + 1; i++) printf("%d ", ans[i][k]); printf("\n"); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 1280 KB | Output is correct |
3 | Correct | 2 ms | 1408 KB | Output is correct |
4 | Correct | 2 ms | 1024 KB | Output is correct |
5 | Correct | 1 ms | 1024 KB | Output is correct |
6 | Correct | 1 ms | 1536 KB | Output is correct |
7 | Correct | 1 ms | 1408 KB | Output is correct |
8 | Correct | 9 ms | 2432 KB | Output is correct |
9 | Correct | 8 ms | 2432 KB | Output is correct |
10 | Correct | 5 ms | 4096 KB | Output is correct |
11 | Correct | 4 ms | 4096 KB | Output is correct |
12 | Correct | 6 ms | 3840 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 1280 KB | Output is correct |
3 | Correct | 2 ms | 1408 KB | Output is correct |
4 | Correct | 2 ms | 1024 KB | Output is correct |
5 | Correct | 1 ms | 1024 KB | Output is correct |
6 | Correct | 1 ms | 1536 KB | Output is correct |
7 | Correct | 1 ms | 1408 KB | Output is correct |
8 | Correct | 9 ms | 2432 KB | Output is correct |
9 | Correct | 8 ms | 2432 KB | Output is correct |
10 | Correct | 5 ms | 4096 KB | Output is correct |
11 | Correct | 4 ms | 4096 KB | Output is correct |
12 | Correct | 6 ms | 3840 KB | Output is correct |
13 | Correct | 54 ms | 32120 KB | Output is correct |
14 | Correct | 426 ms | 23544 KB | Output is correct |
15 | Correct | 444 ms | 28664 KB | Output is correct |
16 | Correct | 605 ms | 31864 KB | Output is correct |
17 | Correct | 311 ms | 31344 KB | Output is correct |
18 | Correct | 293 ms | 31352 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 384 KB | Output is correct |
2 | Correct | 1 ms | 1280 KB | Output is correct |
3 | Correct | 2 ms | 1408 KB | Output is correct |
4 | Correct | 2 ms | 1024 KB | Output is correct |
5 | Correct | 1 ms | 1024 KB | Output is correct |
6 | Correct | 1 ms | 1536 KB | Output is correct |
7 | Correct | 1 ms | 1408 KB | Output is correct |
8 | Correct | 9 ms | 2432 KB | Output is correct |
9 | Correct | 8 ms | 2432 KB | Output is correct |
10 | Correct | 5 ms | 4096 KB | Output is correct |
11 | Correct | 4 ms | 4096 KB | Output is correct |
12 | Correct | 6 ms | 3840 KB | Output is correct |
13 | Correct | 54 ms | 32120 KB | Output is correct |
14 | Correct | 426 ms | 23544 KB | Output is correct |
15 | Correct | 444 ms | 28664 KB | Output is correct |
16 | Correct | 605 ms | 31864 KB | Output is correct |
17 | Correct | 311 ms | 31344 KB | Output is correct |
18 | Correct | 293 ms | 31352 KB | Output is correct |
19 | Incorrect | 1 ms | 384 KB | Output isn't correct |
20 | Halted | 0 ms | 0 KB | - |