Submission #132843

#TimeUsernameProblemLanguageResultExecution timeMemory
132843MinnakhmetovLottery (CEOI18_lot)C++14
25 / 100
4 ms760 KiB
#include<bits/stdc++.h>
using namespace std;

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

const int N = 305;
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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...