#include<bits/stdc++.h>
using namespace std;
int main(){
int l, r;
cin >> l >> r;
int ans = 0;
vector < vector < int >> v(r);
for(int i = 0; i < r; i++){
int n; cin >> n;
while(n--){
int x; cin >> x;
v[i].push_back(x);
}
}
for(int i = 1; i <= l; i++){
bool ok = true;
for(int j = 0; j < r; j++){
int sum1 = 0, sum2 = 0;
bool f = true;
for(int x : v[j]){
if(sum1 + x < i && f){
sum1 += x;
}
else{
f = false;
sum2 += x;
}
}
//cout << i << " " << j << " " << sum1 << " " << sum2 << endl;
if(l - i < sum2){
ok = false;
}
if(!ok) {
//cout << "break for " << i << " " << j << endl;
break;
}
}
if(ok) ans++;
}
cout << l - ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
3256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
492 KB |
Output is correct |
2 |
Correct |
1 ms |
372 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
1 ms |
364 KB |
Output is correct |
7 |
Correct |
1 ms |
364 KB |
Output is correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Correct |
1 ms |
364 KB |
Output is correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
3256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
364 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |