# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
856702 | ntkphong | Lottery (CEOI18_lot) | C++14 | 18 ms | 31780 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int mxN = 2000 + 10;
int n, l, q;
int a[mxN];
int dp[mxN][mxN];
int prefix[mxN];
int answer[mxN][mxN];
int main() {
#define taskname ""
if(fopen(taskname".inp", "r")) {
freopen(taskname".inp", "r", stdin);
freopen(taskname".out", "w", stdout);
}
cin.tie(0)->sync_with_stdio(0);
cin >> n >> l;
if(n > 2000) return 0;
for(int i = 1; i <= n; i ++) cin >> a[i];
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= n; j ++) {
dp[i][j] = dp[i - 1][j - 1] + (a[i] != a[j]);
}
}
for(int i = l; i <= n; i ++) {
for(int j = l; j <= n; j ++) {
int x = dp[i][j] - dp[i - l][j - l];
prefix[x] ++ ;
}
answer[i - l + 1][0] = prefix[0];
for(int j = 1; j <= n; j ++) {
prefix[j] += prefix[j - 1];
answer[i - l + 1][j] = prefix[j];
}
for(int j = 0; j <= n; j ++)
prefix[j] = 0;
}
cin >> q;
while(q --) {
int k;
cin >> k;
for(int i = 1; i <= n - l + 1; i ++) {
cout << answer[i][k] - 1 << " ";
}
cout << "\n";
}
return 0;
}
컴파일 시 표준 에러 (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... |