# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
261173 |
2020-08-11T13:16:01 Z |
sjimed |
Lottery (CEOI18_lot) |
C++14 |
|
565 ms |
8440 KB |
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define eb emplace_back
#define em emplace
#define pre(a) cout<<fixed; cout.precision(a)
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
int n, l, q;
int a[10010];
int k[110];
int g[10010];
int ans[111][10010];
int main() {
fast;
cin >> n >> l;
for(int i=1; i<=n; i++) {
cin >> a[i];
}
cin >> q;
for(int i=1; i<=q; i++) {
cin >> k[i];
g[k[i]+1] = 1;
}
for(int i=1; i<=n; i++) {
g[i] += g[i-1];
}
for(int i=1; i+l<=n; i++) {
int cnt = 0;
for(int j=1; j<=l; j++) {
cnt += a[j] != a[j+i];
}
ans[g[cnt]][1]++;
ans[g[cnt]][i+1]++;
for(int j=1; j+l+i <= n; j++) {
cnt -= a[j+i] != a[j];
cnt += a[j+l+i] != a[j+l];
ans[g[cnt]][j+1]++;
ans[g[cnt]][j+i+1]++;
}
}
for(int i=1; i<q; i++) {
for(int j=1; j<=n-l+1; j++) {
ans[i][j] += ans[i-1][j];
}
}
for(int i=1; i<=q; i++) {
if(i > 1) cout << "\n";
for(int j=1; j<=n-l; j++)
cout << ans[g[k[i]]][j] << " ";
cout << ans[g[k[i]]][n-l+1];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
2 ms |
512 KB |
Output is correct |
11 |
Correct |
1 ms |
512 KB |
Output is correct |
12 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
2 ms |
512 KB |
Output is correct |
11 |
Correct |
1 ms |
512 KB |
Output is correct |
12 |
Correct |
2 ms |
512 KB |
Output is correct |
13 |
Correct |
20 ms |
512 KB |
Output is correct |
14 |
Correct |
12 ms |
640 KB |
Output is correct |
15 |
Correct |
11 ms |
512 KB |
Output is correct |
16 |
Correct |
19 ms |
640 KB |
Output is correct |
17 |
Correct |
17 ms |
640 KB |
Output is correct |
18 |
Correct |
17 ms |
672 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
476 ms |
632 KB |
Output is correct |
2 |
Correct |
473 ms |
632 KB |
Output is correct |
3 |
Correct |
470 ms |
632 KB |
Output is correct |
4 |
Correct |
464 ms |
632 KB |
Output is correct |
5 |
Correct |
139 ms |
504 KB |
Output is correct |
6 |
Correct |
422 ms |
632 KB |
Output is correct |
7 |
Correct |
132 ms |
504 KB |
Output is correct |
8 |
Correct |
253 ms |
504 KB |
Output is correct |
9 |
Correct |
449 ms |
512 KB |
Output is correct |
10 |
Correct |
457 ms |
552 KB |
Output is correct |
11 |
Correct |
22 ms |
512 KB |
Output is correct |
12 |
Correct |
235 ms |
632 KB |
Output is correct |
13 |
Correct |
196 ms |
504 KB |
Output is correct |
14 |
Correct |
180 ms |
504 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
476 ms |
632 KB |
Output is correct |
2 |
Correct |
473 ms |
632 KB |
Output is correct |
3 |
Correct |
470 ms |
632 KB |
Output is correct |
4 |
Correct |
464 ms |
632 KB |
Output is correct |
5 |
Correct |
139 ms |
504 KB |
Output is correct |
6 |
Correct |
422 ms |
632 KB |
Output is correct |
7 |
Correct |
132 ms |
504 KB |
Output is correct |
8 |
Correct |
253 ms |
504 KB |
Output is correct |
9 |
Correct |
449 ms |
512 KB |
Output is correct |
10 |
Correct |
457 ms |
552 KB |
Output is correct |
11 |
Correct |
22 ms |
512 KB |
Output is correct |
12 |
Correct |
235 ms |
632 KB |
Output is correct |
13 |
Correct |
196 ms |
504 KB |
Output is correct |
14 |
Correct |
180 ms |
504 KB |
Output is correct |
15 |
Correct |
463 ms |
632 KB |
Output is correct |
16 |
Correct |
391 ms |
664 KB |
Output is correct |
17 |
Correct |
471 ms |
512 KB |
Output is correct |
18 |
Correct |
467 ms |
772 KB |
Output is correct |
19 |
Correct |
464 ms |
632 KB |
Output is correct |
20 |
Correct |
465 ms |
548 KB |
Output is correct |
21 |
Correct |
466 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
512 KB |
Output is correct |
10 |
Correct |
2 ms |
512 KB |
Output is correct |
11 |
Correct |
1 ms |
512 KB |
Output is correct |
12 |
Correct |
2 ms |
512 KB |
Output is correct |
13 |
Correct |
20 ms |
512 KB |
Output is correct |
14 |
Correct |
12 ms |
640 KB |
Output is correct |
15 |
Correct |
11 ms |
512 KB |
Output is correct |
16 |
Correct |
19 ms |
640 KB |
Output is correct |
17 |
Correct |
17 ms |
640 KB |
Output is correct |
18 |
Correct |
17 ms |
672 KB |
Output is correct |
19 |
Correct |
476 ms |
632 KB |
Output is correct |
20 |
Correct |
473 ms |
632 KB |
Output is correct |
21 |
Correct |
470 ms |
632 KB |
Output is correct |
22 |
Correct |
464 ms |
632 KB |
Output is correct |
23 |
Correct |
139 ms |
504 KB |
Output is correct |
24 |
Correct |
422 ms |
632 KB |
Output is correct |
25 |
Correct |
132 ms |
504 KB |
Output is correct |
26 |
Correct |
253 ms |
504 KB |
Output is correct |
27 |
Correct |
449 ms |
512 KB |
Output is correct |
28 |
Correct |
457 ms |
552 KB |
Output is correct |
29 |
Correct |
22 ms |
512 KB |
Output is correct |
30 |
Correct |
235 ms |
632 KB |
Output is correct |
31 |
Correct |
196 ms |
504 KB |
Output is correct |
32 |
Correct |
180 ms |
504 KB |
Output is correct |
33 |
Correct |
463 ms |
632 KB |
Output is correct |
34 |
Correct |
391 ms |
664 KB |
Output is correct |
35 |
Correct |
471 ms |
512 KB |
Output is correct |
36 |
Correct |
467 ms |
772 KB |
Output is correct |
37 |
Correct |
464 ms |
632 KB |
Output is correct |
38 |
Correct |
465 ms |
548 KB |
Output is correct |
39 |
Correct |
466 ms |
632 KB |
Output is correct |
40 |
Correct |
485 ms |
2040 KB |
Output is correct |
41 |
Correct |
15 ms |
640 KB |
Output is correct |
42 |
Correct |
481 ms |
2100 KB |
Output is correct |
43 |
Correct |
454 ms |
1784 KB |
Output is correct |
44 |
Correct |
453 ms |
1828 KB |
Output is correct |
45 |
Correct |
565 ms |
8196 KB |
Output is correct |
46 |
Correct |
23 ms |
1536 KB |
Output is correct |
47 |
Correct |
555 ms |
8440 KB |
Output is correct |
48 |
Correct |
502 ms |
6392 KB |
Output is correct |
49 |
Correct |
507 ms |
7032 KB |
Output is correct |