# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
239833 | 2020-06-17T11:15:19 Z | mhy908 | Lasers (NOI19_lasers) | C++14 | 579 ms | 29304 KB |
#include <bits/stdc++.h> #define eb emplace_back #define F first #define S second using namespace std; typedef long long LL; int n, q; int arr[500010], sum[500010], ans, tmp, pv=1; map<int, int> m; int main(){ scanf("%d %d", &n, &q); m[n+1]=0; for(int i=1; i<=q; i++){ int sz; scanf("%d", &sz); for(int j=1; j<=sz; j++){ scanf("%d", &arr[j]); sum[j]=sum[j-1]+arr[j]; } for(int j=1; j<=sz; j++){ int e=sum[j], s=n-(sum[sz]-sum[j-1])+1; if(s<=e){ m[s]++; m[e+1]--; } } } for(auto i:m){ if(tmp)ans+=i.F-pv+1; tmp+=i.S; pv=i.F+1; } printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 142 ms | 6136 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 448 ms | 25720 KB | Output is correct |
18 | Correct | 4 ms | 384 KB | Output is correct |
19 | Correct | 4 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 16120 KB | Output is correct |
2 | Correct | 23 ms | 3328 KB | Output is correct |
3 | Correct | 23 ms | 2432 KB | Output is correct |
4 | Correct | 115 ms | 18656 KB | Output is correct |
5 | Correct | 46 ms | 7672 KB | Output is correct |
6 | Correct | 67 ms | 8440 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 83 ms | 8824 KB | Output is correct |
9 | Correct | 83 ms | 13560 KB | Output is correct |
10 | Correct | 139 ms | 20696 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 6 ms | 512 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 113 ms | 16120 KB | Output is correct |
2 | Correct | 23 ms | 3328 KB | Output is correct |
3 | Correct | 23 ms | 2432 KB | Output is correct |
4 | Correct | 115 ms | 18656 KB | Output is correct |
5 | Correct | 46 ms | 7672 KB | Output is correct |
6 | Correct | 67 ms | 8440 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 83 ms | 8824 KB | Output is correct |
9 | Correct | 83 ms | 13560 KB | Output is correct |
10 | Correct | 139 ms | 20696 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 6 ms | 512 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 5 ms | 384 KB | Output is correct |
18 | Correct | 5 ms | 384 KB | Output is correct |
19 | Correct | 5 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 461 ms | 22652 KB | Output is correct |
22 | Correct | 69 ms | 6520 KB | Output is correct |
23 | Correct | 37 ms | 5240 KB | Output is correct |
24 | Correct | 145 ms | 16376 KB | Output is correct |
25 | Correct | 439 ms | 22264 KB | Output is correct |
26 | Correct | 158 ms | 12376 KB | Output is correct |
27 | Correct | 54 ms | 5496 KB | Output is correct |
28 | Correct | 451 ms | 22268 KB | Output is correct |
29 | Correct | 489 ms | 22648 KB | Output is correct |
30 | Correct | 106 ms | 11896 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 142 ms | 6136 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 5 ms | 384 KB | Output is correct |
15 | Correct | 5 ms | 384 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 448 ms | 25720 KB | Output is correct |
18 | Correct | 4 ms | 384 KB | Output is correct |
19 | Correct | 4 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 113 ms | 16120 KB | Output is correct |
22 | Correct | 23 ms | 3328 KB | Output is correct |
23 | Correct | 23 ms | 2432 KB | Output is correct |
24 | Correct | 115 ms | 18656 KB | Output is correct |
25 | Correct | 46 ms | 7672 KB | Output is correct |
26 | Correct | 67 ms | 8440 KB | Output is correct |
27 | Correct | 6 ms | 640 KB | Output is correct |
28 | Correct | 83 ms | 8824 KB | Output is correct |
29 | Correct | 83 ms | 13560 KB | Output is correct |
30 | Correct | 139 ms | 20696 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 5 ms | 384 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 5 ms | 384 KB | Output is correct |
35 | Correct | 6 ms | 512 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 384 KB | Output is correct |
38 | Correct | 5 ms | 384 KB | Output is correct |
39 | Correct | 5 ms | 384 KB | Output is correct |
40 | Correct | 5 ms | 384 KB | Output is correct |
41 | Correct | 461 ms | 22652 KB | Output is correct |
42 | Correct | 69 ms | 6520 KB | Output is correct |
43 | Correct | 37 ms | 5240 KB | Output is correct |
44 | Correct | 145 ms | 16376 KB | Output is correct |
45 | Correct | 439 ms | 22264 KB | Output is correct |
46 | Correct | 158 ms | 12376 KB | Output is correct |
47 | Correct | 54 ms | 5496 KB | Output is correct |
48 | Correct | 451 ms | 22268 KB | Output is correct |
49 | Correct | 489 ms | 22648 KB | Output is correct |
50 | Correct | 106 ms | 11896 KB | Output is correct |
51 | Correct | 52 ms | 7392 KB | Output is correct |
52 | Correct | 494 ms | 28360 KB | Output is correct |
53 | Correct | 476 ms | 28156 KB | Output is correct |
54 | Correct | 102 ms | 9208 KB | Output is correct |
55 | Correct | 306 ms | 21920 KB | Output is correct |
56 | Correct | 135 ms | 17400 KB | Output is correct |
57 | Correct | 192 ms | 15884 KB | Output is correct |
58 | Correct | 579 ms | 29304 KB | Output is correct |
59 | Correct | 132 ms | 11896 KB | Output is correct |
60 | Correct | 176 ms | 14748 KB | Output is correct |