# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1007699 | 2024-06-25T10:41:45 Z | devariaota | Lasers (NOI19_lasers) | C++17 | 143 ms | 15696 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define fi first #define se second #define pb push_back #define pii pair<int, int> #define all(x) x.begin(), x.end() bool ckmin(int& a, int b){return b < a ? a = b, 1 : 0;} bool ckmax(int& a, int b){return b > a ? a = b, 1 : 0;} const int N = 2e5 + 5, mod = 1e9 + 7; signed main(){ ios_base::sync_with_stdio(0), cin.tie(0); int n, q; cin >> n >> q; set<pii> st; while(q--) { int k, s = 0; cin >> k; vector<int> v(k); int r = n, id = 0; for(int i = 0; i < k; i++) { cin >> v[i]; s += v[i]; } int ll = 0, l = n - s + 1; int rl = -1, rh = -1; for(int i = 0; i < k; i++) { ll += v[i]; if(ll >= l) st.insert({l, ll}); // cout << i << " " << ll << " " << l << endl; l += v[i]; } } // for(auto i : st) cout << i.fi << " " << i.se << endl; int l = -1, r = -1, ans = 0; for(auto i : st) { if(l == -1) ans += i.se - i.fi + 1, l = i.se + 1; else if(i.se >= l) { l = max(l, i.fi); ans += i.se - l + 1; l = i.se + 1; } } cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 58 ms | 436 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 135 ms | 13264 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 12152 KB | Output is correct |
2 | Correct | 7 ms | 2164 KB | Output is correct |
3 | Correct | 6 ms | 1472 KB | Output is correct |
4 | Correct | 42 ms | 13492 KB | Output is correct |
5 | Correct | 14 ms | 5468 KB | Output is correct |
6 | Correct | 20 ms | 3852 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 25 ms | 6088 KB | Output is correct |
9 | Correct | 28 ms | 9560 KB | Output is correct |
10 | Correct | 49 ms | 15568 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 344 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 12152 KB | Output is correct |
2 | Correct | 7 ms | 2164 KB | Output is correct |
3 | Correct | 6 ms | 1472 KB | Output is correct |
4 | Correct | 42 ms | 13492 KB | Output is correct |
5 | Correct | 14 ms | 5468 KB | Output is correct |
6 | Correct | 20 ms | 3852 KB | Output is correct |
7 | Correct | 1 ms | 604 KB | Output is correct |
8 | Correct | 25 ms | 6088 KB | Output is correct |
9 | Correct | 28 ms | 9560 KB | Output is correct |
10 | Correct | 49 ms | 15568 KB | Output is correct |
11 | Correct | 0 ms | 344 KB | Output is correct |
12 | Correct | 0 ms | 348 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 1 ms | 344 KB | Output is correct |
17 | Correct | 0 ms | 348 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 135 ms | 12116 KB | Output is correct |
22 | Correct | 22 ms | 4444 KB | Output is correct |
23 | Correct | 10 ms | 3556 KB | Output is correct |
24 | Correct | 43 ms | 11424 KB | Output is correct |
25 | Correct | 143 ms | 12020 KB | Output is correct |
26 | Correct | 49 ms | 8788 KB | Output is correct |
27 | Correct | 18 ms | 3672 KB | Output is correct |
28 | Correct | 130 ms | 12192 KB | Output is correct |
29 | Correct | 128 ms | 12252 KB | Output is correct |
30 | Correct | 30 ms | 8348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 0 ms | 348 KB | Output is correct |
9 | Correct | 1 ms | 348 KB | Output is correct |
10 | Correct | 0 ms | 348 KB | Output is correct |
11 | Correct | 0 ms | 348 KB | Output is correct |
12 | Correct | 58 ms | 436 KB | Output is correct |
13 | Correct | 0 ms | 348 KB | Output is correct |
14 | Correct | 0 ms | 348 KB | Output is correct |
15 | Correct | 0 ms | 348 KB | Output is correct |
16 | Correct | 0 ms | 348 KB | Output is correct |
17 | Correct | 135 ms | 13264 KB | Output is correct |
18 | Correct | 0 ms | 348 KB | Output is correct |
19 | Correct | 0 ms | 348 KB | Output is correct |
20 | Correct | 0 ms | 348 KB | Output is correct |
21 | Correct | 42 ms | 12152 KB | Output is correct |
22 | Correct | 7 ms | 2164 KB | Output is correct |
23 | Correct | 6 ms | 1472 KB | Output is correct |
24 | Correct | 42 ms | 13492 KB | Output is correct |
25 | Correct | 14 ms | 5468 KB | Output is correct |
26 | Correct | 20 ms | 3852 KB | Output is correct |
27 | Correct | 1 ms | 604 KB | Output is correct |
28 | Correct | 25 ms | 6088 KB | Output is correct |
29 | Correct | 28 ms | 9560 KB | Output is correct |
30 | Correct | 49 ms | 15568 KB | Output is correct |
31 | Correct | 0 ms | 344 KB | Output is correct |
32 | Correct | 0 ms | 348 KB | Output is correct |
33 | Correct | 0 ms | 348 KB | Output is correct |
34 | Correct | 0 ms | 348 KB | Output is correct |
35 | Correct | 0 ms | 348 KB | Output is correct |
36 | Correct | 1 ms | 344 KB | Output is correct |
37 | Correct | 0 ms | 348 KB | Output is correct |
38 | Correct | 0 ms | 348 KB | Output is correct |
39 | Correct | 0 ms | 348 KB | Output is correct |
40 | Correct | 0 ms | 348 KB | Output is correct |
41 | Correct | 135 ms | 12116 KB | Output is correct |
42 | Correct | 22 ms | 4444 KB | Output is correct |
43 | Correct | 10 ms | 3556 KB | Output is correct |
44 | Correct | 43 ms | 11424 KB | Output is correct |
45 | Correct | 143 ms | 12020 KB | Output is correct |
46 | Correct | 49 ms | 8788 KB | Output is correct |
47 | Correct | 18 ms | 3672 KB | Output is correct |
48 | Correct | 130 ms | 12192 KB | Output is correct |
49 | Correct | 128 ms | 12252 KB | Output is correct |
50 | Correct | 30 ms | 8348 KB | Output is correct |
51 | Correct | 15 ms | 4768 KB | Output is correct |
52 | Correct | 134 ms | 15092 KB | Output is correct |
53 | Correct | 143 ms | 15232 KB | Output is correct |
54 | Correct | 30 ms | 5456 KB | Output is correct |
55 | Correct | 85 ms | 12624 KB | Output is correct |
56 | Correct | 42 ms | 10568 KB | Output is correct |
57 | Correct | 55 ms | 9296 KB | Output is correct |
58 | Correct | 142 ms | 15696 KB | Output is correct |
59 | Correct | 43 ms | 7248 KB | Output is correct |
60 | Correct | 58 ms | 8528 KB | Output is correct |