| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1024122 | NValchanov | Lottery (CEOI18_lot) | C++17 | 497 ms | 41304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
typedef long long ll;
const int MAXN = 1e4 + 10;
int n, k, q;
int a[MAXN];
int cnt[MAXN][MAXN];
void read()
{
cin >> n >> k;
for(int i = 1; i <= n; i++)
{
cin >> a[i];
}
}
void solve()
{
for(int i = 1; i <= n - k + 1; i++)
{
for(int j = i + 1; j <= n - k + 1; j++)
{
int matches = 0;
for(int idx = 1; idx <= k; idx++)
{
if(a[i + idx - 1] != a[j + idx - 1])
matches++;
}
for(int idx = matches; idx <= k; idx++)
{
cnt[i][idx]++;
cnt[j][idx]++;
}
}
}
}
void process_queries()
{
cin >> q;
for(int i = 1; i <= q; i++)
{
int c;
cin >> c;
for(int j = 1; j <= n - k + 1; j++)
{
cout << cnt[j][c] << " ";
}
cout << endl;
}
}
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
read();
solve();
process_queries();
return 0;
}| # | 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... | ||||
