#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;
while (r--) {
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;
memset (dp, 0, sizeof(dp));
for (int i = 0; i < qts; i++) {
++dp[cur];
--dp[l - s - 1 + 1];
cur += arr[i];
s -= arr[i];
}
++dp[cur];
--dp[l - s - 1 + 1];
int x = 0;
for (int i = 0; i < l; i++) {
x += dp[i];
if (!x && !is_invalid[i]) {
++res;
is_invalid[i] = true;
}
}
}
cout << res << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
8448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
8448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
6032 KB |
Output is correct |
2 |
Correct |
16 ms |
5760 KB |
Output is correct |
3 |
Correct |
16 ms |
5632 KB |
Output is correct |
4 |
Correct |
33 ms |
6536 KB |
Output is correct |
5 |
Correct |
22 ms |
6144 KB |
Output is correct |
6 |
Correct |
36 ms |
7288 KB |
Output is correct |
7 |
Correct |
10 ms |
5120 KB |
Output is correct |
8 |
Correct |
43 ms |
6996 KB |
Output is correct |
9 |
Correct |
24 ms |
5888 KB |
Output is correct |
10 |
Correct |
39 ms |
6580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
4224 KB |
Output is correct |
2 |
Correct |
8 ms |
4224 KB |
Output is correct |
3 |
Correct |
7 ms |
4224 KB |
Output is correct |
4 |
Correct |
8 ms |
4352 KB |
Output is correct |
5 |
Correct |
10 ms |
4224 KB |
Output is correct |
6 |
Correct |
19 ms |
4224 KB |
Output is correct |
7 |
Correct |
115 ms |
4224 KB |
Output is correct |
8 |
Correct |
127 ms |
4316 KB |
Output is correct |
9 |
Correct |
121 ms |
4320 KB |
Output is correct |
10 |
Correct |
8 ms |
4224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
6032 KB |
Output is correct |
2 |
Correct |
16 ms |
5760 KB |
Output is correct |
3 |
Correct |
16 ms |
5632 KB |
Output is correct |
4 |
Correct |
33 ms |
6536 KB |
Output is correct |
5 |
Correct |
22 ms |
6144 KB |
Output is correct |
6 |
Correct |
36 ms |
7288 KB |
Output is correct |
7 |
Correct |
10 ms |
5120 KB |
Output is correct |
8 |
Correct |
43 ms |
6996 KB |
Output is correct |
9 |
Correct |
24 ms |
5888 KB |
Output is correct |
10 |
Correct |
39 ms |
6580 KB |
Output is correct |
11 |
Correct |
18 ms |
4224 KB |
Output is correct |
12 |
Correct |
8 ms |
4224 KB |
Output is correct |
13 |
Correct |
7 ms |
4224 KB |
Output is correct |
14 |
Correct |
8 ms |
4352 KB |
Output is correct |
15 |
Correct |
10 ms |
4224 KB |
Output is correct |
16 |
Correct |
19 ms |
4224 KB |
Output is correct |
17 |
Correct |
115 ms |
4224 KB |
Output is correct |
18 |
Correct |
127 ms |
4316 KB |
Output is correct |
19 |
Correct |
121 ms |
4320 KB |
Output is correct |
20 |
Correct |
8 ms |
4224 KB |
Output is correct |
21 |
Execution timed out |
1094 ms |
5244 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
13 ms |
8448 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |