| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 650498 | fatemetmhr | Lottery (CEOI18_lot) | C++17 | 675 ms | 8288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// ~Be name khoda~ //
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
#define cl clear
#define endll '\n'
const int maxn = 1e6 + 10;
const int maxn5 = 1e4 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const int mod = 1e9 + 7;
const ll inf = 2e18;
vector <pair<int, int>> qu;
int a[maxn5], have[maxn5], reff[maxn5], ind[103];
int ans[102][maxn5];
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int n, l; cin >> n >> l;
for(int i = 0; i < n; i++) cin >> a[i];
int q; cin >> q;
for(int i = 0; i < q; i++){
int k; cin >> k;
qu.pb({k, i});
}
sort(all(qu));
if(qu.back().fi < l) qu.pb({l, q});
for(int i = 0; i <= l; i++){
reff[i] = lower_bound(all(qu), mp(i, -1)) - qu.begin();
}
for(int i = 1; i < n; i++){
fill(have, have + n + 2, 0);
for(int j = 0; j + i < n; j++) if(a[j] != a[j + i]){
have[max(0, j - l + 1)]++;
have[j + 1]--;
}
int now = 0;
for(int j = 0; j + i + l - 1 < n; j++){
now += have[j];
ans[reff[now]][j]++;
ans[reff[now]][j + i]++;
}
}
ind[qu[0].se] = 0;
for(int i = 1; i < qu.size(); i++){
for(int j = 0; j < n; j++)
ans[i][j] += ans[i - 1][j];
ind[qu[i].se] = i;
}
for(int i = 0; i < q; i++){
for(int j = 0; j + l - 1 < n; j++) cout << ans[ind[i]][j] << ' ';
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... | ||||
