Submission #503896

#TimeUsernameProblemLanguageResultExecution timeMemory
503896Ai7081Lottery (CEOI18_lot)C++17
25 / 100
1666 ms7492 KiB
#include <bits/stdc++.h> using namespace std; #define N 100005 #define Q 105 int n, L, a[N], q, x[Q], maxx; vector<vector<int>> cnt; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> L; for (int i=1; i<=n; i++) cin >> a[i]; cin >> q; for (int i=1; i<=q; i++) cin >> x[i], maxx=max(maxx, x[i]); cnt.assign(n-L+5, vector<int>(maxx+5, 0)); for (int i=1; i<=n-L+1; i++) { for (int j=1; j<=n-L+1; j++) { if (i==j) continue; int c = 0; for (int k=0; k<L; k++) { if (a[i+k]!=a[j+k]) c++; } cnt[i][c]++; } } for (int i=1; i<=n-L+1; i++) { for (int j=1; j<=L; j++) { cnt[i][j] += cnt[i][j-1]; } } for (int j=1; j<=q; j++) { for (int i=1; i<=n-L+1; i++) cout << cnt[i][x[j]] << ' '; 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...