Submission #740426

#TimeUsernameProblemLanguageResultExecution timeMemory
740426kirakaminski968Lottery (CEOI18_lot)C++17
45 / 100
529 ms65536 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N,L; cin >> N >> L; vector<int> arr(N); vector<vector<int>> dist(N,vector<int>(N+1,0)); for(int i = 0;i<N;++i) cin >> arr[i]; for(int i = 0;i<N-L+1;++i){ for(int j = i+1;j<N-L+1;++j){ int dis = 0; for(int k = 0;k<L;++k){ if(arr[i+k] != arr[j+k]) ++dis; } ++dist[i][dis]; ++dist[j][dis]; } } for(int i = 0;i<N;++i){ for(int j = 1;j<=N;++j) dist[i][j] += dist[i][j-1]; } int Q; cin >> Q; while(Q--){ int k; cin >> k; for(int i = 0;i<N-L+1;++i){ if(i != N-L) cout << dist[i][k] << " "; else cout << dist[i][k] << "\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...