Submission #1068580

#TimeUsernameProblemLanguageResultExecution timeMemory
1068580PotatoTheWarriorFRTTLottery (CEOI18_lot)C++14
45 / 100
3072 ms8284 KiB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
ll MOD = 1000000007;

ll power(ll x, ll y) {
    ll res = 1;
    while(y != 0) {
        if(y%2) {
            res = (res*x)%MOD;
        }
        x = (x*x)%MOD;
        y/=2;
    }
    return res;
}

void solve() {
    int n, l; cin >> n >> l;
    int a[n+1];
    for(int i=0;i<n;i++) {
        cin >> a[i];
    }
    int dp[n-l+1][l+1];
    for(int i=0;i<n-l+1;i++) {
        for(int j=0;j<=l;j++) {
            dp[i][j] = 0;
        }
    }
    for(int i=0;i<n-l+1;i++) {
        for(int j=0;j<n-l+1;j++) {
            int m = 0;
            if(i!=j) {
                for(int k = 0;k<l;k++) {
                    m += (a[i+k] == a[j+k]);
                }
                dp[i][m]++;
            }
        }
    }
    int q; cin >> q;

    for(int c=0;c<q;c++) {
        int k; cin >> k;
        for(int i=0;i<n-l+1;i++) {
            int ans = 0;
            for(int j = l-k;j<=l;j++) {
                ans += dp[i][j];
            }
            cout << ans << " ";
        }
        cout << endl;
    }
 
}
int main()   {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // int t; cin >> t;
    // while(t--) 
        solve();

    char dksfjn;
    cin >> dksfjn;
}
#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...