# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
917964 |
2024-01-29T08:11:34 Z |
PM1 |
Lottery (CEOI18_lot) |
C++17 |
|
203 ms |
928 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int mxn=1e4+5,M=1e9+7;
ll ans[mxn],n,q,a[mxn],l,base=727;
map<int,int>mp;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>n>>l;
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n-l+1;i++){
ll hs=0;
for(int j=i;j<i+l;j++){
hs=((hs*base)%M+a[j])%M;
}
ans[i]=hs;
mp[hs]++;
}
cin>>q;
for(int i=1;i<=q;i++){
int x;
cin>>x;
for(int j=1;j<=n-l+1;j++){
cout<<mp[ans[j]]-1<<" ";
}
cout<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
19 ms |
684 KB |
Output is correct |
5 |
Correct |
203 ms |
852 KB |
Output is correct |
6 |
Correct |
56 ms |
872 KB |
Output is correct |
7 |
Correct |
199 ms |
604 KB |
Output is correct |
8 |
Correct |
168 ms |
604 KB |
Output is correct |
9 |
Correct |
28 ms |
680 KB |
Output is correct |
10 |
Correct |
18 ms |
684 KB |
Output is correct |
11 |
Correct |
17 ms |
348 KB |
Output is correct |
12 |
Correct |
117 ms |
852 KB |
Output is correct |
13 |
Correct |
195 ms |
928 KB |
Output is correct |
14 |
Correct |
196 ms |
924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Correct |
3 ms |
604 KB |
Output is correct |
4 |
Correct |
19 ms |
684 KB |
Output is correct |
5 |
Correct |
203 ms |
852 KB |
Output is correct |
6 |
Correct |
56 ms |
872 KB |
Output is correct |
7 |
Correct |
199 ms |
604 KB |
Output is correct |
8 |
Correct |
168 ms |
604 KB |
Output is correct |
9 |
Correct |
28 ms |
680 KB |
Output is correct |
10 |
Correct |
18 ms |
684 KB |
Output is correct |
11 |
Correct |
17 ms |
348 KB |
Output is correct |
12 |
Correct |
117 ms |
852 KB |
Output is correct |
13 |
Correct |
195 ms |
928 KB |
Output is correct |
14 |
Correct |
196 ms |
924 KB |
Output is correct |
15 |
Incorrect |
30 ms |
860 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |