답안 #132844

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
132844 2019-07-19T18:08:50 Z Minnakhmetov Lottery (CEOI18_lot) C++14
45 / 100
74 ms 16248 KB
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define all(aaa) aaa.begin(), aaa.end()

const int N = 2005;
int a[N], b[N][N], ans[N];

signed main() {
#ifdef HOME
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, l;
    cin >> n >> l;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (a[i] != a[j]) {
                int x = min(i, l - 1);
                b[i - x][j - x]++;
                b[i + 1][j + 1]--;
            }
        }
    }

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

    int q;
    cin >> q;

    while (q--) {
        int k;
        cin >> k;

        fill(ans, ans + n, 0);

        for (int i = 0; i <= n - l; i++) {
            for (int j = i + 1; j <= n - l; j++) {
                if (b[i][j] <= k) {
                    ans[i]++;
                    ans[j]++;
                }
            }
        }

        for (int i = 0; i < n - l + 1; i++) {
            cout << ans[i] << " ";
        }
        cout << "\n";
    }



    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 764 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 3 ms 888 KB Output is correct
6 Correct 8 ms 760 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 6 ms 1912 KB Output is correct
9 Correct 5 ms 2040 KB Output is correct
10 Correct 3 ms 1912 KB Output is correct
11 Correct 5 ms 1912 KB Output is correct
12 Correct 6 ms 1916 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 764 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 3 ms 888 KB Output is correct
6 Correct 8 ms 760 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 6 ms 1912 KB Output is correct
9 Correct 5 ms 2040 KB Output is correct
10 Correct 3 ms 1912 KB Output is correct
11 Correct 5 ms 1912 KB Output is correct
12 Correct 6 ms 1916 KB Output is correct
13 Correct 53 ms 16140 KB Output is correct
14 Correct 74 ms 16220 KB Output is correct
15 Correct 33 ms 16120 KB Output is correct
16 Correct 58 ms 16248 KB Output is correct
17 Correct 51 ms 16136 KB Output is correct
18 Correct 54 ms 16120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 764 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 732 KB Output is correct
5 Correct 3 ms 888 KB Output is correct
6 Correct 8 ms 760 KB Output is correct
7 Correct 3 ms 760 KB Output is correct
8 Correct 6 ms 1912 KB Output is correct
9 Correct 5 ms 2040 KB Output is correct
10 Correct 3 ms 1912 KB Output is correct
11 Correct 5 ms 1912 KB Output is correct
12 Correct 6 ms 1916 KB Output is correct
13 Correct 53 ms 16140 KB Output is correct
14 Correct 74 ms 16220 KB Output is correct
15 Correct 33 ms 16120 KB Output is correct
16 Correct 58 ms 16248 KB Output is correct
17 Correct 51 ms 16136 KB Output is correct
18 Correct 54 ms 16120 KB Output is correct
19 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Halted 0 ms 0 KB -