# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
240573 | 2020-06-20T05:59:17 Z | arnold518 | Lasers (NOI19_lasers) | C++14 | 532 ms | 29212 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 5e5; int N, MM, K, A[MAXN+10], S[MAXN+10]; map<int, int> M; int main() { int i, j; scanf("%d%d", &N, &MM); while(MM--) { scanf("%d", &K); int D=N; for(i=1; i<=K; i++) scanf("%d", &A[i]), S[i]=S[i-1]+A[i], D-=A[i]; S[K+1]=N; for(i=0; i<=K; i++) { int l=S[i]+D+1, r=S[i+1]; if(l<=r) M[l]++, M[r+1]--; } } int ans=0, sum=0; for(auto it=M.begin(); it!=M.end() && next(it)!=M.end(); it++) { sum+=it->second; if(sum!=0) ans+=(next(it)->first)-(it->first); } printf("%d\n", 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 | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 4 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 | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 4 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 | 145 ms | 6008 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 4 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 | 461 ms | 25844 KB | Output is correct |
18 | Correct | 5 ms | 256 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 | 118 ms | 16760 KB | Output is correct |
2 | Correct | 23 ms | 3328 KB | Output is correct |
3 | Correct | 21 ms | 2432 KB | Output is correct |
4 | Correct | 112 ms | 18680 KB | Output is correct |
5 | Correct | 47 ms | 7800 KB | Output is correct |
6 | Correct | 66 ms | 8440 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 82 ms | 8824 KB | Output is correct |
9 | Correct | 84 ms | 13560 KB | Output is correct |
10 | Correct | 136 ms | 20644 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 | 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 | 118 ms | 16760 KB | Output is correct |
2 | Correct | 23 ms | 3328 KB | Output is correct |
3 | Correct | 21 ms | 2432 KB | Output is correct |
4 | Correct | 112 ms | 18680 KB | Output is correct |
5 | Correct | 47 ms | 7800 KB | Output is correct |
6 | Correct | 66 ms | 8440 KB | Output is correct |
7 | Correct | 6 ms | 640 KB | Output is correct |
8 | Correct | 82 ms | 8824 KB | Output is correct |
9 | Correct | 84 ms | 13560 KB | Output is correct |
10 | Correct | 136 ms | 20644 KB | Output is correct |
11 | Correct | 5 ms | 384 KB | Output is correct |
12 | Correct | 4 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 | 5 ms | 384 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 | 460 ms | 22392 KB | Output is correct |
22 | Correct | 68 ms | 6520 KB | Output is correct |
23 | Correct | 36 ms | 5240 KB | Output is correct |
24 | Correct | 138 ms | 16372 KB | Output is correct |
25 | Correct | 466 ms | 22392 KB | Output is correct |
26 | Correct | 159 ms | 12408 KB | Output is correct |
27 | Correct | 55 ms | 5496 KB | Output is correct |
28 | Correct | 448 ms | 22392 KB | Output is correct |
29 | Correct | 463 ms | 22624 KB | Output is correct |
30 | Correct | 99 ms | 12024 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 | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Correct | 4 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 | 145 ms | 6008 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 4 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 | 461 ms | 25844 KB | Output is correct |
18 | Correct | 5 ms | 256 KB | Output is correct |
19 | Correct | 4 ms | 384 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 118 ms | 16760 KB | Output is correct |
22 | Correct | 23 ms | 3328 KB | Output is correct |
23 | Correct | 21 ms | 2432 KB | Output is correct |
24 | Correct | 112 ms | 18680 KB | Output is correct |
25 | Correct | 47 ms | 7800 KB | Output is correct |
26 | Correct | 66 ms | 8440 KB | Output is correct |
27 | Correct | 6 ms | 640 KB | Output is correct |
28 | Correct | 82 ms | 8824 KB | Output is correct |
29 | Correct | 84 ms | 13560 KB | Output is correct |
30 | Correct | 136 ms | 20644 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 4 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 | 5 ms | 384 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 | 460 ms | 22392 KB | Output is correct |
42 | Correct | 68 ms | 6520 KB | Output is correct |
43 | Correct | 36 ms | 5240 KB | Output is correct |
44 | Correct | 138 ms | 16372 KB | Output is correct |
45 | Correct | 466 ms | 22392 KB | Output is correct |
46 | Correct | 159 ms | 12408 KB | Output is correct |
47 | Correct | 55 ms | 5496 KB | Output is correct |
48 | Correct | 448 ms | 22392 KB | Output is correct |
49 | Correct | 463 ms | 22624 KB | Output is correct |
50 | Correct | 99 ms | 12024 KB | Output is correct |
51 | Correct | 51 ms | 7288 KB | Output is correct |
52 | Correct | 509 ms | 28292 KB | Output is correct |
53 | Correct | 502 ms | 28152 KB | Output is correct |
54 | Correct | 107 ms | 9224 KB | Output is correct |
55 | Correct | 324 ms | 22008 KB | Output is correct |
56 | Correct | 141 ms | 17568 KB | Output is correct |
57 | Correct | 200 ms | 15864 KB | Output is correct |
58 | Correct | 532 ms | 29212 KB | Output is correct |
59 | Correct | 140 ms | 11896 KB | Output is correct |
60 | Correct | 187 ms | 14584 KB | Output is correct |