답안 #760917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
760917 2023-06-18T22:00:50 Z MilosMilutinovic Lottery (CEOI18_lot) C++14
0 / 100
1 ms 340 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2e2 + 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 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 304 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Incorrect 1 ms 212 KB Output isn't correct
9 Halted 0 ms 0 KB -