# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132639 | SamAnd | Lottery (CEOI18_lot) | C++17 | 165 ms | 47864 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 2003;
int n, m;
int a[N];
vector<int> v[N];
int b[N][N];
void ubd(int x1, int x2, int y1, int y2)
{
b[x1][y1]++;
b[x2 + 1][y2 + 1]--;
}
int p[N][N];
int main()
{
//freopen("input.txt", "r", stdin);
scanf("%d%d", &n, &m);
for (int i = 1; i <= n; ++i)
scanf("%d", &a[i]);
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
{
if (a[i] != a[j])
{
int x1 = i - m + 1;
int x2 = i;
int y1 = j - m + 1;
int y2 = j;
int t1 = 0, t2 = 0;
t1 = max(t1, 1 - x1);
t2 = max(t2, x2 - (n - m + 1));
t1 = max(t1, 1 - y1);
t2 = max(t2, y2 - (n - m + 1));
x1 += t1;
y1 += t1;
x2 -= t2;
y2 -= t2;
ubd(x1, x2, y1, y2);
}
}
}
for (int i = 1; i <= n - m + 1; ++i)
{
for (int j = 1; j <= n - m + 1; ++j)
{
p[i][j] = p[i - 1][j - 1] + b[i][j];
if (i != j)
{
v[i].push_back(p[i][j]);
}
}
}
for (int i = 1; i <= n - m + 1; ++i)
sort(v[i].begin(), v[i].end());
int q;
scanf("%d", &q);
while (q--)
{
int d;
scanf("%d", &d);
for (int i = 1; i <= n - m + 1; ++i)
{
printf("%d ", upper_bound(v[i].begin(), v[i].end(), d) - v[i].begin());
}
printf("\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... |