#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int dp [N];
bool is_invalid [N];
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int l, r, res = 0;
cin >> l >> r;
memset (dp, 0, sizeof(dp));
for (int T = 0; T < r; T++) {
int qts;
cin >> qts;
int s = 0;
vector<int> arr (qts);
for (int i = 0; i < qts; i++) {
cin >> arr[i];
s += arr[i];
}
int cur = 0;
int mn = 0;
for (int i = 0; i < qts; i++) {
++dp[max (mn, cur)];
--dp[l - s - 1 + 1];
mn = max (mn, l - s);
cur += arr[i];
s -= arr[i];
}
++dp[max (mn, cur)];
--dp[l - s - 1 + 1];
}
int x = 0;
for (int i = 0; i < l; i++) {
x += dp[i];
if (x != r) ++res;
}
cout << res << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
8448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
8448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
4880 KB |
Output is correct |
2 |
Correct |
12 ms |
4480 KB |
Output is correct |
3 |
Correct |
13 ms |
4352 KB |
Output is correct |
4 |
Correct |
27 ms |
5000 KB |
Output is correct |
5 |
Correct |
24 ms |
4864 KB |
Output is correct |
6 |
Correct |
32 ms |
5632 KB |
Output is correct |
7 |
Correct |
7 ms |
4224 KB |
Output is correct |
8 |
Correct |
35 ms |
5340 KB |
Output is correct |
9 |
Correct |
21 ms |
4480 KB |
Output is correct |
10 |
Correct |
29 ms |
5052 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
4224 KB |
Output is correct |
2 |
Correct |
6 ms |
4224 KB |
Output is correct |
3 |
Correct |
7 ms |
4224 KB |
Output is correct |
4 |
Correct |
7 ms |
4224 KB |
Output is correct |
5 |
Correct |
6 ms |
4224 KB |
Output is correct |
6 |
Correct |
6 ms |
4224 KB |
Output is correct |
7 |
Correct |
7 ms |
4224 KB |
Output is correct |
8 |
Correct |
7 ms |
4224 KB |
Output is correct |
9 |
Correct |
7 ms |
4224 KB |
Output is correct |
10 |
Correct |
7 ms |
4224 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
26 ms |
4880 KB |
Output is correct |
2 |
Correct |
12 ms |
4480 KB |
Output is correct |
3 |
Correct |
13 ms |
4352 KB |
Output is correct |
4 |
Correct |
27 ms |
5000 KB |
Output is correct |
5 |
Correct |
24 ms |
4864 KB |
Output is correct |
6 |
Correct |
32 ms |
5632 KB |
Output is correct |
7 |
Correct |
7 ms |
4224 KB |
Output is correct |
8 |
Correct |
35 ms |
5340 KB |
Output is correct |
9 |
Correct |
21 ms |
4480 KB |
Output is correct |
10 |
Correct |
29 ms |
5052 KB |
Output is correct |
11 |
Correct |
6 ms |
4224 KB |
Output is correct |
12 |
Correct |
6 ms |
4224 KB |
Output is correct |
13 |
Correct |
7 ms |
4224 KB |
Output is correct |
14 |
Correct |
7 ms |
4224 KB |
Output is correct |
15 |
Correct |
6 ms |
4224 KB |
Output is correct |
16 |
Correct |
6 ms |
4224 KB |
Output is correct |
17 |
Correct |
7 ms |
4224 KB |
Output is correct |
18 |
Correct |
7 ms |
4224 KB |
Output is correct |
19 |
Correct |
7 ms |
4224 KB |
Output is correct |
20 |
Correct |
7 ms |
4224 KB |
Output is correct |
21 |
Correct |
122 ms |
8568 KB |
Output is correct |
22 |
Correct |
20 ms |
4864 KB |
Output is correct |
23 |
Correct |
15 ms |
4736 KB |
Output is correct |
24 |
Correct |
39 ms |
5784 KB |
Output is correct |
25 |
Correct |
113 ms |
8568 KB |
Output is correct |
26 |
Correct |
31 ms |
5504 KB |
Output is correct |
27 |
Correct |
19 ms |
4736 KB |
Output is correct |
28 |
Correct |
126 ms |
8584 KB |
Output is correct |
29 |
Correct |
150 ms |
8568 KB |
Output is correct |
30 |
Correct |
34 ms |
5704 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
8448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |