답안 #671746

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
671746 2022-12-13T16:15:31 Z LittleCube Lottery (CEOI18_lot) C++14
100 / 100
594 ms 8376 KB
#include <bits/stdc++.h>
#define ll long long
#define plll tuple<ll, ll, ll>
using namespace std;

int n, l, q, a[10005], ans[10005][105], pos[10005], b[105], qu[105];
signed main()
{
    cin >> n >> l;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    cin >> q;
    for (int i = 1; i <= q; i++)
    {
        cin >> b[i];
        qu[i] = b[i];
    }
    sort(qu + 1, qu + 1 + q);
    for (int i = q; i >= 1; i--)
        for (int j = qu[i - 1]; j <= qu[i]; j++)
            pos[j] = i;
    for (int d = 1; d <= n - l; d++)
    {
        int cur = 0;
        for (int i = 0; i < l; i++)
            cur += a[i] != a[i + d];
        for (int i = 1; i + l - 1 + d <= n; i++)
        {
            cur -= a[i - 1] != a[i - 1 + d];
            cur += a[i + l - 1] != a[i + l - 1 + d];
            ans[i][pos[cur]]++;
            ans[i + d][pos[cur]]++;
        }
    }
    for (int i = 1; i <= q; i++)
        for (int j = 1; j <= n - l + 1; j++)
        {
            int sum = 0;
            for (int k = 1; k <= q; k++)
                if (qu[k] <= b[i])
                    sum += ans[j][k];
            cout << sum << " \n"[j == n - l + 1];
        }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 18 ms 1148 KB Output is correct
14 Correct 12 ms 840 KB Output is correct
15 Correct 10 ms 852 KB Output is correct
16 Correct 18 ms 1060 KB Output is correct
17 Correct 16 ms 1088 KB Output is correct
18 Correct 16 ms 1144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 422 ms 4452 KB Output is correct
2 Correct 417 ms 4556 KB Output is correct
3 Correct 422 ms 4468 KB Output is correct
4 Correct 405 ms 4456 KB Output is correct
5 Correct 124 ms 2500 KB Output is correct
6 Correct 366 ms 4300 KB Output is correct
7 Correct 123 ms 2496 KB Output is correct
8 Correct 215 ms 3304 KB Output is correct
9 Correct 409 ms 4392 KB Output is correct
10 Correct 402 ms 4448 KB Output is correct
11 Correct 19 ms 1108 KB Output is correct
12 Correct 215 ms 3284 KB Output is correct
13 Correct 161 ms 2856 KB Output is correct
14 Correct 161 ms 2772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 422 ms 4452 KB Output is correct
2 Correct 417 ms 4556 KB Output is correct
3 Correct 422 ms 4468 KB Output is correct
4 Correct 405 ms 4456 KB Output is correct
5 Correct 124 ms 2500 KB Output is correct
6 Correct 366 ms 4300 KB Output is correct
7 Correct 123 ms 2496 KB Output is correct
8 Correct 215 ms 3304 KB Output is correct
9 Correct 409 ms 4392 KB Output is correct
10 Correct 402 ms 4448 KB Output is correct
11 Correct 19 ms 1108 KB Output is correct
12 Correct 215 ms 3284 KB Output is correct
13 Correct 161 ms 2856 KB Output is correct
14 Correct 161 ms 2772 KB Output is correct
15 Correct 388 ms 4320 KB Output is correct
16 Correct 340 ms 4172 KB Output is correct
17 Correct 412 ms 4556 KB Output is correct
18 Correct 407 ms 4484 KB Output is correct
19 Correct 408 ms 4536 KB Output is correct
20 Correct 403 ms 4488 KB Output is correct
21 Correct 407 ms 4556 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 304 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 18 ms 1148 KB Output is correct
14 Correct 12 ms 840 KB Output is correct
15 Correct 10 ms 852 KB Output is correct
16 Correct 18 ms 1060 KB Output is correct
17 Correct 16 ms 1088 KB Output is correct
18 Correct 16 ms 1144 KB Output is correct
19 Correct 422 ms 4452 KB Output is correct
20 Correct 417 ms 4556 KB Output is correct
21 Correct 422 ms 4468 KB Output is correct
22 Correct 405 ms 4456 KB Output is correct
23 Correct 124 ms 2500 KB Output is correct
24 Correct 366 ms 4300 KB Output is correct
25 Correct 123 ms 2496 KB Output is correct
26 Correct 215 ms 3304 KB Output is correct
27 Correct 409 ms 4392 KB Output is correct
28 Correct 402 ms 4448 KB Output is correct
29 Correct 19 ms 1108 KB Output is correct
30 Correct 215 ms 3284 KB Output is correct
31 Correct 161 ms 2856 KB Output is correct
32 Correct 161 ms 2772 KB Output is correct
33 Correct 388 ms 4320 KB Output is correct
34 Correct 340 ms 4172 KB Output is correct
35 Correct 412 ms 4556 KB Output is correct
36 Correct 407 ms 4484 KB Output is correct
37 Correct 408 ms 4536 KB Output is correct
38 Correct 403 ms 4488 KB Output is correct
39 Correct 407 ms 4556 KB Output is correct
40 Correct 434 ms 5184 KB Output is correct
41 Correct 16 ms 852 KB Output is correct
42 Correct 418 ms 5180 KB Output is correct
43 Correct 410 ms 4684 KB Output is correct
44 Correct 401 ms 4864 KB Output is correct
45 Correct 594 ms 8200 KB Output is correct
46 Correct 30 ms 1108 KB Output is correct
47 Correct 567 ms 8376 KB Output is correct
48 Correct 520 ms 6492 KB Output is correct
49 Correct 523 ms 7024 KB Output is correct