# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1026363 |
2024-07-18T02:39:03 Z |
vjudge1 |
Lottery (CEOI18_lot) |
C++17 |
|
225 ms |
31324 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
int ans[2005][2005];
int a[2000+5];
int n,l;
string s;
map<string,int>brp;
void solve(){
for(int q=1;q<=n-l+1;q++){
for(int w=q+1;w<=n-l+1;w++){
int bny=0;
for(int u=1;u<=l;u++){
if(a[q+u-1]!=a[w+u-1]){
bny++;
}
}
for(int r=bny;r<=l;r++){
ans[q][r]++;
ans[w][r]++;
}
}
}
}
void solve2(){
for(int q=1;q<=n-l+1;q++){
string tmp=s.substr(q-1,l);
brp[tmp]++;
}
}
signed main(){
cin>>n>>l;
for(int t=1;t<=n;t++){
cin>>a[t];
s+=char(a[t]+48);
}
int q;
cin>>q;
if(q==1){
int b;
cin>>b;
solve2();
for(int p=1;p<=n-l+1;p++){
string tmp=s.substr(p-1,l);
// cout<<tmp<<endl;
cout<<brp[tmp]-1<<" ";
}
return 0;
}
solve();
for(int t=1;t<=q;t++){
int b;
cin>>b;
for(int r=1;r<=n-l+1;r++){
cout<<ans[r][b]<<" ";
}
cout<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
4444 KB |
Output is correct |
9 |
Correct |
2 ms |
4444 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
1 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
4444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
4444 KB |
Output is correct |
9 |
Correct |
2 ms |
4444 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
1 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
4444 KB |
Output is correct |
13 |
Correct |
16 ms |
31324 KB |
Output is correct |
14 |
Correct |
205 ms |
23060 KB |
Output is correct |
15 |
Correct |
225 ms |
23112 KB |
Output is correct |
16 |
Correct |
159 ms |
29264 KB |
Output is correct |
17 |
Correct |
204 ms |
27220 KB |
Output is correct |
18 |
Correct |
187 ms |
27180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
5 ms |
640 KB |
Output is correct |
4 |
Correct |
6 ms |
1116 KB |
Output is correct |
5 |
Correct |
25 ms |
25244 KB |
Output is correct |
6 |
Correct |
12 ms |
6492 KB |
Output is correct |
7 |
Correct |
8 ms |
604 KB |
Output is correct |
8 |
Correct |
6 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
912 KB |
Output is correct |
10 |
Correct |
5 ms |
712 KB |
Output is correct |
11 |
Correct |
3 ms |
1884 KB |
Output is correct |
12 |
Correct |
14 ms |
13040 KB |
Output is correct |
13 |
Correct |
19 ms |
24864 KB |
Output is correct |
14 |
Correct |
23 ms |
24724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
604 KB |
Output is correct |
3 |
Correct |
5 ms |
640 KB |
Output is correct |
4 |
Correct |
6 ms |
1116 KB |
Output is correct |
5 |
Correct |
25 ms |
25244 KB |
Output is correct |
6 |
Correct |
12 ms |
6492 KB |
Output is correct |
7 |
Correct |
8 ms |
604 KB |
Output is correct |
8 |
Correct |
6 ms |
604 KB |
Output is correct |
9 |
Correct |
5 ms |
912 KB |
Output is correct |
10 |
Correct |
5 ms |
712 KB |
Output is correct |
11 |
Correct |
3 ms |
1884 KB |
Output is correct |
12 |
Correct |
14 ms |
13040 KB |
Output is correct |
13 |
Correct |
19 ms |
24864 KB |
Output is correct |
14 |
Correct |
23 ms |
24724 KB |
Output is correct |
15 |
Incorrect |
9 ms |
4444 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
0 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
4444 KB |
Output is correct |
9 |
Correct |
2 ms |
4444 KB |
Output is correct |
10 |
Correct |
2 ms |
6492 KB |
Output is correct |
11 |
Correct |
1 ms |
6492 KB |
Output is correct |
12 |
Correct |
1 ms |
4444 KB |
Output is correct |
13 |
Correct |
16 ms |
31324 KB |
Output is correct |
14 |
Correct |
205 ms |
23060 KB |
Output is correct |
15 |
Correct |
225 ms |
23112 KB |
Output is correct |
16 |
Correct |
159 ms |
29264 KB |
Output is correct |
17 |
Correct |
204 ms |
27220 KB |
Output is correct |
18 |
Correct |
187 ms |
27180 KB |
Output is correct |
19 |
Correct |
2 ms |
344 KB |
Output is correct |
20 |
Correct |
3 ms |
604 KB |
Output is correct |
21 |
Correct |
5 ms |
640 KB |
Output is correct |
22 |
Correct |
6 ms |
1116 KB |
Output is correct |
23 |
Correct |
25 ms |
25244 KB |
Output is correct |
24 |
Correct |
12 ms |
6492 KB |
Output is correct |
25 |
Correct |
8 ms |
604 KB |
Output is correct |
26 |
Correct |
6 ms |
604 KB |
Output is correct |
27 |
Correct |
5 ms |
912 KB |
Output is correct |
28 |
Correct |
5 ms |
712 KB |
Output is correct |
29 |
Correct |
3 ms |
1884 KB |
Output is correct |
30 |
Correct |
14 ms |
13040 KB |
Output is correct |
31 |
Correct |
19 ms |
24864 KB |
Output is correct |
32 |
Correct |
23 ms |
24724 KB |
Output is correct |
33 |
Incorrect |
9 ms |
4444 KB |
Output isn't correct |
34 |
Halted |
0 ms |
0 KB |
- |