#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;
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 |
266 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
266 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
3280 KB |
Output is correct |
2 |
Correct |
7 ms |
1752 KB |
Output is correct |
3 |
Correct |
8 ms |
1908 KB |
Output is correct |
4 |
Correct |
24 ms |
3292 KB |
Output is correct |
5 |
Correct |
12 ms |
2396 KB |
Output is correct |
6 |
Correct |
18 ms |
3788 KB |
Output is correct |
7 |
Correct |
3 ms |
1108 KB |
Output is correct |
8 |
Correct |
22 ms |
4180 KB |
Output is correct |
9 |
Correct |
15 ms |
2516 KB |
Output is correct |
10 |
Correct |
19 ms |
3412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
504 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
3280 KB |
Output is correct |
2 |
Correct |
7 ms |
1752 KB |
Output is correct |
3 |
Correct |
8 ms |
1908 KB |
Output is correct |
4 |
Correct |
24 ms |
3292 KB |
Output is correct |
5 |
Correct |
12 ms |
2396 KB |
Output is correct |
6 |
Correct |
18 ms |
3788 KB |
Output is correct |
7 |
Correct |
3 ms |
1108 KB |
Output is correct |
8 |
Correct |
22 ms |
4180 KB |
Output is correct |
9 |
Correct |
15 ms |
2516 KB |
Output is correct |
10 |
Correct |
19 ms |
3412 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
504 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Execution timed out |
1040 ms |
34692 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
266 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |