제출 #1214064

#제출 시각아이디문제언어결과실행 시간메모리
1214064lopkusLottery (CEOI18_lot)C++20
45 / 100
63 ms131072 KiB
#include <bits/stdc++.h> #define int int64_t signed main() { int n, l; std::cin >> n >> l; std::vector<int> a(n + 1); for(int i = 1; i <= n; i++) { std::cin >> a[i]; } std::vector<std::vector<int>> pref(n + 2, std::vector<int>(n + 1)); for(int j = 1; j <= n; j++) { for(int i = n; i >= 1; i--) { pref[i][j] = pref[i + 1][j]; if(i + j <= n) { pref[i][j] += (a[i] != a[i + j]); } } } int q; std::cin >> q; while(q--) { int k; std::cin >> k; std::vector<int> ans(n + 1); for(int i = 1; i + l - 1 <= n; i++) { for(int j = i + 1; j + l - 1 <= n; j++) { int s = j - i; if(pref[i][s] - pref[i + l][s] <= k) { ans[i] += 1; ans[j] += 1; } } } for(int i = 1; i + l - 1 <= n; i++) { std::cout << ans[i] << " "; } std::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...