#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int l,r;
cin >> l >> r;
vector<int>walls[r];
int sums[r];
for(int i = 0;i<r;i++){
int x;
cin >> x;
sums[i]=0;
for(int j = 0;j<x;j++){
int c;
cin >> c;
sums[i]+=c;
walls[i].push_back(c);
}
}
bool val[l];
fill(val,val+l,0);
for(int i = 0;i<r;i++){
int curl = 0;
for(int w : walls[i]){
int lef = sums[i]-curl;
lef=l-lef;
int right = curl+w-1;
if(right<lef){
continue;
}
for(int a = lef;a<=right;a++){
val[a]=1;
}
curl+=w;
}
}
int ans = 0;
for(int i = 0;i<l;i++){
ans+=val[i];
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
225 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
225 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
2640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
225 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |