This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |