Submission #246342

#TimeUsernameProblemLanguageResultExecution timeMemory
246342SortingLottery (CEOI18_lot)C++14
45 / 100
746 ms65540 KiB
#include <bits/stdc++.h> using namespace std; const int k_N = 1e4 + 3; int n, l; int a[k_N]; short cnt[k_N][k_N]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); cin >> n >> l; for(int i = 0; i < n; ++i) cin >> a[i]; for(int i = 0; i < n - l + 1; ++i){ for(int j = i + 1; j < n - l + 1; ++j){ int diff = 0; for(int k = 0; k < l; ++k) if(a[i + k] != a[j + k]) diff++; cnt[i][diff]++; cnt[j][diff]++; } } for(int i = 0; i < n; ++i) for(int j = 1; j < n; ++j) cnt[i][j] += cnt[i][j - 1]; int q; cin >> q; for(int i = 0; i < q; ++i){ int k; cin >> k; for(int j = 0; j < n - l + 1; ++j) cout << cnt[j][k] << " "; cout << "\n"; } }
#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...