# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132652 | 2019-07-19T09:35:16 Z | SamAnd | Lottery (CEOI18_lot) | C++17 | 178 ms | 47864 KB |
#include <bits/stdc++.h> using namespace std; const int N = 2003; int n, m; int a[N]; vector<int> v[N]; int b[N][N]; void ubd(int x1, int x2, int y1, int y2) { if (x1 > x2 || y1 > y2) return; if (x1 < 0 || x2 < 0 || y1 < 0 || y2 < 0) return; b[x1][y1]++; b[x2 + 1][y2 + 1]--; } int p[N][N]; int main() { //freopen("input.txt", "r", stdin); scanf("%d%d", &n, &m); //n = 2000; //m = 1000; for (int i = 1; i <= n; ++i) { //a[i] = rand(); scanf("%d", &a[i]); } for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n; ++j) { if (a[i] != a[j]) { int x1 = i - m + 1; int x2 = i; int y1 = j - m + 1; int y2 = j; int t1 = 0, t2 = 0; t1 = max(t1, 1 - x1); //t2 = max(t2, x2 - (n - m + 1)); t1 = max(t1, 1 - y1); //t2 = max(t2, y2 - (n - m + 1)); x1 += t1; y1 += t1; //x2 -= t2; //y2 -= t2; ubd(x1, x2, y1, y2); } } } for (int i = 1; i <= n - m + 1; ++i) { for (int j = 1; j <= n - m + 1; ++j) { p[i][j] = p[i - 1][j - 1] + b[i][j]; if (i != j) { v[i].push_back(p[i][j]); } } } for (int i = 1; i <= n - m + 1; ++i) sort(v[i].begin(), v[i].end()); int q; scanf("%d", &q); while (q--) { int d; scanf("%d", &d); for (int i = 1; i <= n - m + 1; ++i) { printf("%d ", upper_bound(v[i].begin(), v[i].end(), d) - v[i].begin()); } printf("\n"); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 1144 KB | Output is correct |
3 | Correct | 3 ms | 1272 KB | Output is correct |
4 | Correct | 3 ms | 1016 KB | Output is correct |
5 | Correct | 3 ms | 1016 KB | Output is correct |
6 | Correct | 3 ms | 1272 KB | Output is correct |
7 | Correct | 3 ms | 1144 KB | Output is correct |
8 | Correct | 6 ms | 2808 KB | Output is correct |
9 | Correct | 6 ms | 2780 KB | Output is correct |
10 | Correct | 8 ms | 3960 KB | Output is correct |
11 | Correct | 8 ms | 3960 KB | Output is correct |
12 | Correct | 7 ms | 3808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 1144 KB | Output is correct |
3 | Correct | 3 ms | 1272 KB | Output is correct |
4 | Correct | 3 ms | 1016 KB | Output is correct |
5 | Correct | 3 ms | 1016 KB | Output is correct |
6 | Correct | 3 ms | 1272 KB | Output is correct |
7 | Correct | 3 ms | 1144 KB | Output is correct |
8 | Correct | 6 ms | 2808 KB | Output is correct |
9 | Correct | 6 ms | 2780 KB | Output is correct |
10 | Correct | 8 ms | 3960 KB | Output is correct |
11 | Correct | 8 ms | 3960 KB | Output is correct |
12 | Correct | 7 ms | 3808 KB | Output is correct |
13 | Runtime error | 178 ms | 47864 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 3 ms | 1144 KB | Output is correct |
3 | Correct | 3 ms | 1272 KB | Output is correct |
4 | Correct | 3 ms | 1016 KB | Output is correct |
5 | Correct | 3 ms | 1016 KB | Output is correct |
6 | Correct | 3 ms | 1272 KB | Output is correct |
7 | Correct | 3 ms | 1144 KB | Output is correct |
8 | Correct | 6 ms | 2808 KB | Output is correct |
9 | Correct | 6 ms | 2780 KB | Output is correct |
10 | Correct | 8 ms | 3960 KB | Output is correct |
11 | Correct | 8 ms | 3960 KB | Output is correct |
12 | Correct | 7 ms | 3808 KB | Output is correct |
13 | Runtime error | 178 ms | 47864 KB | Memory limit exceeded (if you are sure your verdict is not MLE, please contact us) |
14 | Halted | 0 ms | 0 KB | - |