#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int l, r;
vector<int> s[N];
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> l >> r;
for(int i = 0; i < r; i++) {
int x; cin >> x;
for(int j = 0; j < x; j++) {
int p; cin >> p;
if(s[i].empty()) s[i].push_back(p);
else s[i].push_back(s[i].back() + p);
}
}
int ans = l;
for(int i = 1; i <= l; i++) {
bool ok = 1;
for(int j = 0; j < r; j++) {
auto it = lower_bound(s[j].begin(), s[j].end(), i);
int x = (it == s[j].begin() ? 0 : *(--it));
ok &= l - i >= s[j].back() - x;
}
ans -= ok;
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1097 ms |
11988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1097 ms |
11988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
81 ms |
14804 KB |
Output is correct |
2 |
Correct |
52 ms |
12592 KB |
Output is correct |
3 |
Correct |
52 ms |
12888 KB |
Output is correct |
4 |
Correct |
80 ms |
14312 KB |
Output is correct |
5 |
Correct |
57 ms |
13516 KB |
Output is correct |
6 |
Correct |
96 ms |
14920 KB |
Output is correct |
7 |
Correct |
26 ms |
12140 KB |
Output is correct |
8 |
Correct |
100 ms |
15968 KB |
Output is correct |
9 |
Correct |
60 ms |
13260 KB |
Output is correct |
10 |
Correct |
82 ms |
14892 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
11988 KB |
Output is correct |
2 |
Correct |
7 ms |
11988 KB |
Output is correct |
3 |
Correct |
7 ms |
12064 KB |
Output is correct |
4 |
Correct |
9 ms |
11988 KB |
Output is correct |
5 |
Correct |
7 ms |
12064 KB |
Output is correct |
6 |
Correct |
7 ms |
11988 KB |
Output is correct |
7 |
Correct |
10 ms |
12068 KB |
Output is correct |
8 |
Correct |
11 ms |
12068 KB |
Output is correct |
9 |
Correct |
11 ms |
11988 KB |
Output is correct |
10 |
Correct |
7 ms |
12068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
81 ms |
14804 KB |
Output is correct |
2 |
Correct |
52 ms |
12592 KB |
Output is correct |
3 |
Correct |
52 ms |
12888 KB |
Output is correct |
4 |
Correct |
80 ms |
14312 KB |
Output is correct |
5 |
Correct |
57 ms |
13516 KB |
Output is correct |
6 |
Correct |
96 ms |
14920 KB |
Output is correct |
7 |
Correct |
26 ms |
12140 KB |
Output is correct |
8 |
Correct |
100 ms |
15968 KB |
Output is correct |
9 |
Correct |
60 ms |
13260 KB |
Output is correct |
10 |
Correct |
82 ms |
14892 KB |
Output is correct |
11 |
Correct |
7 ms |
11988 KB |
Output is correct |
12 |
Correct |
7 ms |
11988 KB |
Output is correct |
13 |
Correct |
7 ms |
12064 KB |
Output is correct |
14 |
Correct |
9 ms |
11988 KB |
Output is correct |
15 |
Correct |
7 ms |
12064 KB |
Output is correct |
16 |
Correct |
7 ms |
11988 KB |
Output is correct |
17 |
Correct |
10 ms |
12068 KB |
Output is correct |
18 |
Correct |
11 ms |
12068 KB |
Output is correct |
19 |
Correct |
11 ms |
11988 KB |
Output is correct |
20 |
Correct |
7 ms |
12068 KB |
Output is correct |
21 |
Execution timed out |
1082 ms |
31784 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1097 ms |
11988 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |