답안 #217519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
217519 2020-03-30T05:27:24 Z DystoriaX Lottery (CEOI18_lot) C++14
45 / 100
63 ms 16248 KB
#include <bits/stdc++.h>

using namespace std;

int n, l;
int a[2010], b[2010];
int cnt[2010][2010];
int q;

int main(){
    scanf("%d%d", &n, &l);

    for(int i = 1; i <= n; i++) scanf("%d", &a[i]), b[i] = a[i];

    for(int d = 1; d < n - l + 1; d++){
        int diff = 0;

        for(int j = 1; j <= l; j++){
            if(a[j] != a[j + d]) diff++;
        }

        cnt[diff][1]++;
        cnt[diff][d + 1]++;

        for(int i = 2; i + l + d - 1 <= n; i++){
            if(a[i - 1] != a[i + d - 1]) diff--;
            if(a[i + l - 1] != a[i + l - 1 + d]) diff++;

            // cout << "Comparing " << i + l - 1 << " with " << i + l + d - 

            cnt[diff][i]++;
            cnt[diff][i + d]++;
        }
    }

    for(int i = 1; i <= n; i++){
        for(int k = 1; k <= n; k++)
            cnt[k][i] += cnt[k - 1][i];
    }

    scanf("%d", &q);

    while(q--){
        int k; scanf("%d", &k);

        for(int i = 1; i <= n - l + 1; i++) printf("%d ", cnt[k][i]);
        printf("\n");
    }
    
    return 0;
}

Compilation message

lot.cpp: In function 'int main()':
lot.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &l);
     ~~~~~^~~~~~~~~~~~~~~~
lot.cpp:13:51: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; i++) scanf("%d", &a[i]), b[i] = a[i];
                                 ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
lot.cpp:41:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &q);
     ~~~~~^~~~~~~~~~
lot.cpp:44:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         int k; scanf("%d", &k);
                ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 768 KB Output is correct
3 Correct 5 ms 768 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 5 ms 768 KB Output is correct
6 Correct 5 ms 768 KB Output is correct
7 Correct 5 ms 768 KB Output is correct
8 Correct 6 ms 1792 KB Output is correct
9 Correct 6 ms 1920 KB Output is correct
10 Correct 6 ms 1920 KB Output is correct
11 Correct 7 ms 1920 KB Output is correct
12 Correct 6 ms 1920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 768 KB Output is correct
3 Correct 5 ms 768 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 5 ms 768 KB Output is correct
6 Correct 5 ms 768 KB Output is correct
7 Correct 5 ms 768 KB Output is correct
8 Correct 6 ms 1792 KB Output is correct
9 Correct 6 ms 1920 KB Output is correct
10 Correct 6 ms 1920 KB Output is correct
11 Correct 7 ms 1920 KB Output is correct
12 Correct 6 ms 1920 KB Output is correct
13 Correct 63 ms 16120 KB Output is correct
14 Correct 61 ms 16248 KB Output is correct
15 Correct 59 ms 16120 KB Output is correct
16 Correct 62 ms 16248 KB Output is correct
17 Correct 62 ms 16248 KB Output is correct
18 Correct 61 ms 16248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 768 KB Output is correct
3 Correct 5 ms 768 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
5 Correct 5 ms 768 KB Output is correct
6 Correct 5 ms 768 KB Output is correct
7 Correct 5 ms 768 KB Output is correct
8 Correct 6 ms 1792 KB Output is correct
9 Correct 6 ms 1920 KB Output is correct
10 Correct 6 ms 1920 KB Output is correct
11 Correct 7 ms 1920 KB Output is correct
12 Correct 6 ms 1920 KB Output is correct
13 Correct 63 ms 16120 KB Output is correct
14 Correct 61 ms 16248 KB Output is correct
15 Correct 59 ms 16120 KB Output is correct
16 Correct 62 ms 16248 KB Output is correct
17 Correct 62 ms 16248 KB Output is correct
18 Correct 61 ms 16248 KB Output is correct
19 Incorrect 5 ms 384 KB Output isn't correct
20 Halted 0 ms 0 KB -