# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
155648 | 2019-09-29T14:43:59 Z | karma | Lottery (CEOI18_lot) | C++14 | 720 ms | 4464 KB |
#include<bits/stdc++.h> #define Task "test" #define pb emplace_back using namespace std; const int N = int(1e4) + 1; int f[N][102], pre[N], a[N], pos[N], cnt; int n, l, lim, q, k[N]; bool vis[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); if(fopen(Task".inp", "r")) { freopen(Task".inp", "r", stdin); freopen(Task".out", "w", stdout); } cin >> n >> l; lim = n - l + 1; for(int i = 1; i <= n; ++i) cin >> a[i]; cin >> q; for(int i = 1; i <= q; ++i) cin >> k[i], vis[k[i]] = 1; for(int i = 0; i <= l; ++i) pos[i] = (cnt += vis[i]); for(int j = 1; j <= lim; ++j) { for(int i = 1; i <= n; ++i) { if(i + j > n) break; if(a[i] != a[i + j]) pre[i] = pre[i - 1] + 1; else pre[i] = pre[i - 1]; } for(int i = 0; i < lim; ++i) { if(i + j + l > n) break; ++f[i + 1][pos[pre[i + l] - pre[i]]]; ++f[i + j + 1][pos[pre[i + l] - pre[i]]]; } } for(int j = 0; j <= cnt; ++j) { for(int i = 1; i <= lim; ++i) f[i][j] += f[i][j - 1]; } for(int j = 1; j <= q; ++j) { for(int i = 1; i <= lim; ++i) cout << f[i][pos[k[j]]] << ' '; cout << '\n'; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 720 ms | 4464 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 720 ms | 4464 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 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |