# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
736464 |
2023-05-05T17:12:54 Z |
study |
Lottery (CEOI18_lot) |
C++17 |
|
135 ms |
65536 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e4+1;
int a[N];
unsigned short diff[N][N], ans[N][N];
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,l;
cin >> n >> l;
for (int i=0; i<n; ++i){
cin >> a[i];
}
for (int i=1; i<n-l+1; ++i){
for (int j=0; j<l; ++j){
if (a[i+j] != a[j]) diff[0][i]++;
}
ans[0][diff[0][i]]++;
ans[i][diff[0][i]]++;
}
for (int i=1; i<n-l+1; ++i){
for (int j=i+1; j<n-l+1; ++j){
diff[i][j] = diff[i-1][j-1]-(a[i-1] != a[j-1])+(a[i+l-1] != a[j+l-1]);
ans[i][diff[i][j]]++;
ans[j][diff[i][j]]++;
}
}
for (int i=0; i<n; ++i){
for (int j=1; j<=l; ++j){
ans[i][j] += ans[i][j-1];
}
}
int q;
cin >> q;
while (q--){
int k;
cin >> k;
for (int i=0; i<n-l+1; ++i) cout << ans[i][k] << ' ';
cout << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
1 ms |
980 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
852 KB |
Output is correct |
6 |
Correct |
1 ms |
1100 KB |
Output is correct |
7 |
Correct |
1 ms |
980 KB |
Output is correct |
8 |
Correct |
2 ms |
2260 KB |
Output is correct |
9 |
Correct |
2 ms |
2260 KB |
Output is correct |
10 |
Correct |
2 ms |
2772 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
1 ms |
980 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
852 KB |
Output is correct |
6 |
Correct |
1 ms |
1100 KB |
Output is correct |
7 |
Correct |
1 ms |
980 KB |
Output is correct |
8 |
Correct |
2 ms |
2260 KB |
Output is correct |
9 |
Correct |
2 ms |
2260 KB |
Output is correct |
10 |
Correct |
2 ms |
2772 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2644 KB |
Output is correct |
13 |
Correct |
23 ms |
20312 KB |
Output is correct |
14 |
Correct |
20 ms |
18136 KB |
Output is correct |
15 |
Correct |
36 ms |
18160 KB |
Output is correct |
16 |
Correct |
25 ms |
19648 KB |
Output is correct |
17 |
Correct |
23 ms |
19204 KB |
Output is correct |
18 |
Correct |
22 ms |
19196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
135 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
135 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
980 KB |
Output is correct |
3 |
Correct |
1 ms |
980 KB |
Output is correct |
4 |
Correct |
1 ms |
852 KB |
Output is correct |
5 |
Correct |
1 ms |
852 KB |
Output is correct |
6 |
Correct |
1 ms |
1100 KB |
Output is correct |
7 |
Correct |
1 ms |
980 KB |
Output is correct |
8 |
Correct |
2 ms |
2260 KB |
Output is correct |
9 |
Correct |
2 ms |
2260 KB |
Output is correct |
10 |
Correct |
2 ms |
2772 KB |
Output is correct |
11 |
Correct |
2 ms |
2772 KB |
Output is correct |
12 |
Correct |
2 ms |
2644 KB |
Output is correct |
13 |
Correct |
23 ms |
20312 KB |
Output is correct |
14 |
Correct |
20 ms |
18136 KB |
Output is correct |
15 |
Correct |
36 ms |
18160 KB |
Output is correct |
16 |
Correct |
25 ms |
19648 KB |
Output is correct |
17 |
Correct |
23 ms |
19204 KB |
Output is correct |
18 |
Correct |
22 ms |
19196 KB |
Output is correct |
19 |
Runtime error |
135 ms |
65536 KB |
Execution killed with signal 9 |
20 |
Halted |
0 ms |
0 KB |
- |