제출 #397648

#제출 시각아이디문제언어결과실행 시간메모리
397648VictorLottery (CEOI18_lot)C++17
25 / 100
3044 ms520 KiB
#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define per(i, a, b) for (int i = b - 1; i >= (a); --i)
#define trav(a, x) for (auto &a : x)

#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define pb push_back

#define umap unordered_map
#define uset unordered_set

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef long long ll;

const int INF = 1000000007;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    ushort n, l, q, mismatch[10000], ans[10000], groups;
    uint arr[10000];
    cin >> n >> l;
    groups = n - l + 1;

    rep(i, 0, n) cin >> arr[i];

    cin >> q;
    while (q--) {
        ushort diff;
        cin >> diff;
        memset(ans, 0, sizeof(ans));

        rep(k, 0, groups - 1) {
            memset(mismatch, 0, sizeof(mismatch));
            rep(i, k, l+k) rep(j, i + 1, groups + i) if (arr[i] != arr[j])++ mismatch[j - i+k];

            rep(j, k + 1, groups) {
                if (mismatch[j] <= diff) {
                    ++ans[k];
                    ++ans[j];
                }
            }
        }

        rep(i, 0, groups) cout << ans[i] << ' ';
        cout << endl;
    }
    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...