Submission #464247

#TimeUsernameProblemLanguageResultExecution timeMemory
464247paga2004Lottery (CEOI18_lot)C++14
45 / 100
1164 ms65540 KiB
#include <bits/stdc++.h> using namespace std; #define int64 #ifdef int64 #define int int64_t #define INF (int64_t)1e18 #else #define INF (int)(1e9) #endif #ifdef LOCAL #include "debug.hpp" #else #define dbg(x) #endif #define MOD 1000000007 signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, l; cin >> n >> l; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector<vector<int>> dists(n - l + 1, vector<int>(n - l + 1, 0)); for (int i = 0; i < n - l + 1; i++) { for (int j = 0; j < n - l + 1; j++) { for (int k = 0; k < l; k++) { dists[i][j] += a[i + k] != a[j + k]; } } sort(dists[i].begin(), dists[i].end()); } dbg(dists); int q; cin >> q; for (int w = 0; w < q; w++) { int k; cin >> k; for (int i = 0; i < n - l + 1; i++) { auto it = upper_bound(dists[i].begin(), dists[i].end(), k); cout << it - dists[i].begin() - 1 << " "; } 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...