제출 #311766

#제출 시각아이디문제언어결과실행 시간메모리
311766shivensinha4Lottery (CEOI18_lot)C++17
45 / 100
1527 ms65540 KiB
#include <bits/stdc++.h> using namespace std; #define for_(i, s, e) for (int i = s; i < (int) e; i++) #define for__(i, s, e) for (ll i = s; i < e; i++) typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; #define endl '\n' const int MXN = 1e4; int freq[MXN+1][MXN+2]; int main() { #ifdef shiven freopen("test.in", "r", stdin); #endif ios_base::sync_with_stdio(false); cin.tie(0); int n, l; cin >> n >> l; vi nums(n); for_(i, 0, n) cin >> nums[i]; for_(d, 1, n+1) { vi temp(n); for_(j, d, n) if (nums[j] != nums[j-d]) temp[j] += 1; for_(i, d, n) temp[i] += temp[i-1]; for_(j, d, n-l+1) { int dist = temp[j+l-1] - (j > 0 ? temp[j-1] : 0); freq[j][dist] += 1; freq[j-d][dist] += 1; } } for_(i, 0, n) for_(j, 1, n+1) freq[i][j] += freq[i][j-1]; int q; cin >> q; while (q--) { int k; cin >> k; for_(i, 0, n-l+1) cout << freq[i][k] << " "; cout << endl; } 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...