# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
519427 |
2022-01-26T10:50:09 Z |
Jomnoi |
Lasers (NOI19_lasers) |
C++17 |
|
45 ms |
6384 KB |
#include <bits/stdc++.h>
#define DEBUG 0
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
int L, R;
cin >> L >> R;
vector <vector <int>> qs(R + 10);
vector <int> sz(R + 10);
for(int i = 1; i <= R; i++) {
int X;
cin >> X;
sz[i] = X;
qs[i].resize(X + 10, 0);
for(int j = 1; j <= X; j++) {
int a;
cin >> a;
qs[i][j] = qs[i][j - 1] + a;
}
}
vector <pair <int, int>> vec;
for(int i = 1; i <= R; i++) {
for(int j = 1; j <= sz[i]; j++) {
int a = qs[i][j] - qs[i][j - 1];
int pos_left = qs[i][j - 1] + 1;
int pos_right = L - (qs[i][sz[i]] - qs[i][j]);
if(pos_left + a - 1 < pos_right - a + 1) {
continue;
}
vec.emplace_back(pos_right - a + 1, 1);
vec.emplace_back(pos_left + a, 0);
}
}
sort(vec.begin(), vec.end());
int ans = 0;
for(int i = 0; i < (int)vec.size() - 1; i++) {
ans += (vec[i + 1].first - vec[i].first) * vec[i].second;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
308 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
308 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
6384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
6384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
308 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |