답안 #275139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
275139 2020-08-20T04:35:52 Z wutwere Lasers (NOI19_lasers) C++17
100 / 100
486 ms 29304 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	map<int, int> pref;
	int l, r; cin >> l >> r;
	for (int i = 0; i < r; i++) {
		int x; cin >> x;
		vector<int> vals(x);
		int sum = 0, pos = 0;
		for (int j = 0; j < x; j++) {
			cin >> vals[j];
			sum += vals[j];
		}
		for (int j = 0; j < x; j++) {
			int len = l - sum - pos + vals[j];
			if (vals[j] - (len - vals[j]) > 0) {
				pref[l - sum]++;
				pref[l - sum + vals[j] - (len - vals[j])]--;
			}
			sum -= vals[j];
			pos += vals[j];
		}
	}
	int cnt = 0, start = 0, ans = 0;
	for (auto i : pref) {
		bool no = cnt == 0;
		cnt += i.second;
		if (i.second > 0) {
			if (no) {
				start = i.first;
			}
		} else {
			if (cnt == 0) {
				ans += i.first - start;
				// cerr << start << ' ' << i.first - 1 << '\n';
			}
		}
	}
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 107 ms 640 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 421 ms 20164 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 16124 KB Output is correct
2 Correct 17 ms 3084 KB Output is correct
3 Correct 15 ms 2124 KB Output is correct
4 Correct 103 ms 18036 KB Output is correct
5 Correct 37 ms 7288 KB Output is correct
6 Correct 45 ms 6080 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 57 ms 7892 KB Output is correct
9 Correct 73 ms 13044 KB Output is correct
10 Correct 126 ms 20044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 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 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 16124 KB Output is correct
2 Correct 17 ms 3084 KB Output is correct
3 Correct 15 ms 2124 KB Output is correct
4 Correct 103 ms 18036 KB Output is correct
5 Correct 37 ms 7288 KB Output is correct
6 Correct 45 ms 6080 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 57 ms 7892 KB Output is correct
9 Correct 73 ms 13044 KB Output is correct
10 Correct 126 ms 20044 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 1 ms 384 KB Output is correct
18 Correct 1 ms 384 KB Output is correct
19 Correct 1 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 458 ms 22484 KB Output is correct
22 Correct 75 ms 6520 KB Output is correct
23 Correct 28 ms 5120 KB Output is correct
24 Correct 120 ms 15632 KB Output is correct
25 Correct 448 ms 22264 KB Output is correct
26 Correct 197 ms 12440 KB Output is correct
27 Correct 49 ms 5496 KB Output is correct
28 Correct 432 ms 22268 KB Output is correct
29 Correct 431 ms 22520 KB Output is correct
30 Correct 85 ms 11600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 0 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1 ms 384 KB Output is correct
12 Correct 107 ms 640 KB Output is correct
13 Correct 0 ms 384 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 421 ms 20164 KB Output is correct
18 Correct 0 ms 384 KB Output is correct
19 Correct 0 ms 384 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 97 ms 16124 KB Output is correct
22 Correct 17 ms 3084 KB Output is correct
23 Correct 15 ms 2124 KB Output is correct
24 Correct 103 ms 18036 KB Output is correct
25 Correct 37 ms 7288 KB Output is correct
26 Correct 45 ms 6080 KB Output is correct
27 Correct 2 ms 640 KB Output is correct
28 Correct 57 ms 7892 KB Output is correct
29 Correct 73 ms 13044 KB Output is correct
30 Correct 126 ms 20044 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 0 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 1 ms 384 KB Output is correct
39 Correct 1 ms 384 KB Output is correct
40 Correct 1 ms 384 KB Output is correct
41 Correct 458 ms 22484 KB Output is correct
42 Correct 75 ms 6520 KB Output is correct
43 Correct 28 ms 5120 KB Output is correct
44 Correct 120 ms 15632 KB Output is correct
45 Correct 448 ms 22264 KB Output is correct
46 Correct 197 ms 12440 KB Output is correct
47 Correct 49 ms 5496 KB Output is correct
48 Correct 432 ms 22268 KB Output is correct
49 Correct 431 ms 22520 KB Output is correct
50 Correct 85 ms 11600 KB Output is correct
51 Correct 45 ms 7288 KB Output is correct
52 Correct 479 ms 28352 KB Output is correct
53 Correct 486 ms 28156 KB Output is correct
54 Correct 97 ms 9336 KB Output is correct
55 Correct 295 ms 22008 KB Output is correct
56 Correct 135 ms 16956 KB Output is correct
57 Correct 197 ms 15928 KB Output is correct
58 Correct 480 ms 29304 KB Output is correct
59 Correct 139 ms 12024 KB Output is correct
60 Correct 167 ms 14716 KB Output is correct