# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
168946 | kostia244 | Lottery (CEOI18_lot) | C++17 | 3 ms | 1148 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define pb push_back
using namespace std;
using ll = long long;
// using vi vector<int>;
const int maxn = 2222;
int n, l, q, x;
short a[maxn], mat[maxn][maxn], cnt[maxn][maxn];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> l;
for(int i = 1; i <= n; i++) cin >> a[i];
for(int i = 1; i <= n; i++)
for(int j = i+1; j <= n; j++) {
if(a[i]==a[j]) continue;
int diff = j-i;
int L = max(j-l+1, 1+diff);
int R = min(j, n-l+1);
// cout << i << " " << j << " : " << L << " " << R << "\n";
++mat[diff][L];
--mat[diff][R+1];
}
for(int i = 1; i < n; i++) {
ll cur = 0;
for(int j = i+1; j <= n-l+1; j++) {
cur += mat[i][j];
// cout << j << " " << j-i << " " << cur << "\n";
++cnt[j][cur];
++cnt[j-i][cur];
}
}
for(int i = 1; i <= n-l+1; i++) {
for(int j = 1; j <= l; j++) {
cnt[i][j] += cnt[i][j-1];
}
}
cin >> q;
while(q--) {
cin >> x;
for(int i = 1; i <= n-l+1; i++) cout << cnt[i][x] << " ";cout << "\n";
}
}
컴파일 시 표준 에러 (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... |