Submission #483316

#TimeUsernameProblemLanguageResultExecution timeMemory
483316BERNARB01Lottery (CEOI18_lot)C++17
45 / 100
453 ms65540 KiB
#include <bits/stdc++.h> using namespace std; const int N = 10004; int n, l, a[N], q; vector<int> v[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> l; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i + l <= n; i++) { for (int j = i + 1; j + l <= n; j++) { if (j == i) continue; int c = 0; for (int k = 0; k < l; k++) { c += (a[i + k] != a[j + k]); } v[i].push_back(c); v[j].push_back(c); } } for (int i = 0; i + l <= n; i++) { sort(v[i].begin(), v[i].end()); } cin >> q; while (q--) { int k; cin >> k; for (int i = 0; i + l <= n; i++) { if (i > 0) { cout << " "; } cout << upper_bound(v[i].begin(), v[i].end(), k) - v[i].begin(); } cout << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...