# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
484226 | nickmet2004 | Lottery (CEOI18_lot) | C++11 | 486 ms | 65540 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;
int n , l , a[N];
vector<int> B[N];
int main (){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> l;
for(int i = 1; i <= n; ++i) cin >> a[i];
for(int i = 1; i <= n - l+1; ++i){
for(int j = i + 1; j <= n - l+1; ++j){
int cnt = 0;
for(int k = 0; k < l; ++k){
if(a[i + k] != a[j + k]) cnt++;
}
B[i].emplace_back(cnt);
B[j].emplace_back(cnt);
}
}
for(int i = 1; i <= n - l+1; ++i) sort(B[i].begin() , B[i].end());
/*
for(int i = 1; i <= n -l+1; ++i){
for(int x : B[i])cout << x << " ";cout << endl;
}
*/
int q;
cin >> q;
while(q--){
int Kj;
cin >> Kj;
for(int i = 1;i <= n - l + 1; ++i) cout << upper_bound(B[i].begin() ,B[i].end() , Kj) - B[i].begin() << " ";cout << endl;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |