Submission #362198

#TimeUsernameProblemLanguageResultExecution timeMemory
362198sumit_kk10Lottery (CEOI18_lot)C++14
45 / 100
355 ms17132 KiB
#include<bits/stdc++.h> #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define ll long long int using namespace std; const int MOD = 1e9 + 7; const int N = 2000 + 5; int ok[N][N]; void solve() { int n, k; cin >> n >> k; int a[n]; for(int i = 0; i < n; ++i) cin >> a[i]; for(int i = 0; i <= n - k; ++i) { for (int j = i + 1; j <= n - k; ++j) { if (i == j) continue; int diff = 0; for (int e = 0; e < k; ++e) if (a[i + e] != a[j + e]) ++diff; ok[i][j] = diff; ok[j][i] = diff; } } int q; cin >> q; while(q--){ int dis; cin >> dis; for(int i = 0; i <= n - k; ++i) { int ans = 0; for (int j = 0; j <= n - k; ++j) { if (i == j) continue; ans += (ok[i][j] <= dis); } cout << ans << " "; } cout << "\n"; } } int main() { fast; int t = 1; // cin >> t; while(t--) solve(); 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...