# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
114443 |
2019-06-01T10:42:43 Z |
Meloric |
Lottery (CEOI18_lot) |
C++14 |
|
887 ms |
1204 KB |
#include <bits/stdc++.h>
#define pb push_back
#define X first
#define Y second
#define pii pair<int, int>
#define lb lower_bound
using namespace std;
int n, len, q;
vector<int> in, stupid;
vector<pii> place;
vector<vector<int>> ans, pref;
vector<int> dif(int l){
vector<int> ret(q);
ret[0]--;
for(int i = 0; i< n-len+1; i++){
int cur = 0;
for(int j = 0; j < len; j++){
if(in[i+j]!=in[l+j]){
cur++;
}
}
if(cur<stupid[0]){
ret[0]++;
}
/*
int ind = lb(stupid.begin(), stupid.end(), cur)-stupid.begin();
if(ind == q)continue;
ret[ind]++;*/
}
for(int i = 1; i < q; i++){
ret[i]+=ret[i-1];
}
return ret;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> len;
for(int i=0; i < n; i++){
int c; cin >> c;
in.pb(c);
}
cin >> q;
for(int i =0; i < q; i++){
int c; cin >> c;
place.pb({c, i});
stupid.pb(c);
}
sort(place.begin(), place.end());
sort(stupid.begin(), stupid.end());
ans.assign(q, vector<int>());
pref.assign(n-len+1, vector<int>());
for(int i = 0; i < n-len+1; i++){
pref[i] = dif(i);
}
for(int i =0; i< q; i++){
for(int j = 0; j < n-len+1; j++){
ans[place[i].Y].pb(pref[j][i]);
}
}
for(int i = 0; i< q; i++){
for(int j=0; j < n-len+1; j++){
cout << ans[i][j] << ' ';
}
cout << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
887 ms |
1204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
887 ms |
1204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |