답안 #760918

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
760918 2023-06-18T22:02:02 Z MilosMilutinovic Lottery (CEOI18_lot) C++14
45 / 100
72 ms 65536 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 10;
int n, d, q, a[N], f[N][N];
int main() {
    scanf("%d%d", &n, &d);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
    }
    for (int l = 1; l + d - 1 <= n; l++) {
        int cnt = 0;
        for (int i = 1; i <= d; i++)
            cnt += (a[i] != a[l + i - 1]);
        for (int r = 1; l + (d - 1) + (r - 1) <= n; r++) {
            f[r][l + r - 1] = cnt;
            f[l + r - 1][r] = cnt;
            cnt -= (a[l + r - 1] != a[r]);
            cnt += (a[l + r + d - 1] != a[r + d]);
        }
    }
//    for (int i = 1; i + d - 1 <= n; i++)
//        for (int j = i + 1; j + d - 1 <= n; j++)
//            printf("i = %d, j = %d      diff = %d\n", i, j, f[i][j]);
    scanf("%d", &q);
    while (q--) {
        int k;
        scanf("%d", &k);
        for (int i = 1; i + d - 1 <= n; i++) {
            int cnt = 0;
            for (int j = 1; j + d - 1 <= n; j++)
                cnt += (f[i][j] <= k);
            printf("%d ", cnt - 1);
        }
        printf("\n");
    }
    return 0;
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |     scanf("%d%d", &n, &d);
      |     ~~~~~^~~~~~~~~~~~~~~~
lot.cpp:8:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |         scanf("%d", &a[i]);
      |         ~~~~~^~~~~~~~~~~~~
lot.cpp:24:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
lot.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         scanf("%d", &k);
      |         ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 952 KB Output is correct
10 Correct 3 ms 1748 KB Output is correct
11 Correct 3 ms 1720 KB Output is correct
12 Correct 3 ms 1620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 952 KB Output is correct
10 Correct 3 ms 1748 KB Output is correct
11 Correct 3 ms 1720 KB Output is correct
12 Correct 3 ms 1620 KB Output is correct
13 Correct 47 ms 23984 KB Output is correct
14 Correct 34 ms 12748 KB Output is correct
15 Correct 23 ms 12748 KB Output is correct
16 Correct 71 ms 20000 KB Output is correct
17 Correct 61 ms 18000 KB Output is correct
18 Correct 72 ms 18024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 72 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 72 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 596 KB Output is correct
3 Correct 1 ms 596 KB Output is correct
4 Correct 1 ms 468 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 724 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 1 ms 952 KB Output is correct
10 Correct 3 ms 1748 KB Output is correct
11 Correct 3 ms 1720 KB Output is correct
12 Correct 3 ms 1620 KB Output is correct
13 Correct 47 ms 23984 KB Output is correct
14 Correct 34 ms 12748 KB Output is correct
15 Correct 23 ms 12748 KB Output is correct
16 Correct 71 ms 20000 KB Output is correct
17 Correct 61 ms 18000 KB Output is correct
18 Correct 72 ms 18024 KB Output is correct
19 Runtime error 72 ms 65536 KB Execution killed with signal 9
20 Halted 0 ms 0 KB -