# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1127085 | TrieTr | Lottery (CEOI18_lot) | C++20 | 3094 ms | 4636 KiB |
#include<bits/stdc++.h>
using namespace std;
void local() {
#define taskname ""
if (fopen(taskname".inp", "r")) {
freopen(taskname".inp", "r", stdin);
freopen(taskname".out", "w", stdout);
}
}
#define ll long long
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
template<class X, class Y> bool mini(X &a, const Y &b) {return (a > b) ? a = b, true : false;}
template<class X, class Y> bool maxi(X &a, const Y &b) {return (a < b) ? a = b, true : false;}
const int N = 1e4 + 5;
const int Q = 1e2 + 5;
int n, l, q, a[N], que[N];
int cnt[N], pf[N];
int ans[N][Q];
int main() {
fastio; local();
cin >> n >> l;
for(int i = 1; i <= n; i++) cin >> a[i];
cin >> q;
for(int i = 1; i <= q; i++) cin >> que[i];
for(int i = 1; i + l - 1 <= n; i++) {
memset(cnt, 0, sizeof(cnt));
memset(pf, 0, sizeof(pf));
for(int p = 0; p < l; p++)
for(int j = 1; j + l - 1 <= n; j++) cnt[j] += (a[i + p] != a[j + p]);
for(int j = 1; j + l - 1 <= n; j++) pf[cnt[j]]++;
for(int j = 1; j <= l; j++) pf[j] += pf[j - 1];
for(int j = 1; j <= q; j++) ans[i][j] = pf[que[j]] - 1;
}
for(int i = 1; i <= q; i++)
for(int j = 1; j + l - 1 <= n; j++) cout << ans[j][i] << " \n"[j == n - l + 1];
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |