# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1087124 |
2024-09-12T08:34:57 Z |
avighna |
Lasers (NOI19_lasers) |
C++17 |
|
1000 ms |
262144 KB |
#include <bits/stdc++.h>
typedef long long ll;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
ll l, r;
std::cin >> l >> r;
std::vector<bool> good(r);
ll good_sum = 0;
std::priority_queue<std::pair<ll, ll>, std::vector<std::pair<ll, ll>>,
std::greater<>>
pq;
std::vector<ll> left(r), sum(r);
std::vector<std::deque<ll>> rows(r);
for (ll cnt = 0; cnt < r; ++cnt) {
auto &v = rows[cnt];
ll len;
std::cin >> len;
v.resize(len);
for (auto &i : v) {
std::cin >> i;
}
sum[cnt] = std::accumulate(v.begin(), v.end(), 0LL);
pq.push({left[cnt] + v[0], cnt});
v.pop_front();
if (1 < l - (sum[cnt] - left[cnt]) + 1) {
good[cnt] = true;
good_sum++;
} else {
good[cnt] = false;
}
}
ll ans = 0;
for (ll _i = 1; _i <= l; ++_i) {
while (!pq.empty() and pq.top().first < _i) {
auto [l, i] = pq.top();
pq.pop();
left[i] = l;
// x blocks from right ==> l - x + 1 from left
good_sum -= good[i];
if (_i < l - (sum[i] - left[i]) + 1) {
good[i] = true;
good_sum++;
} else {
good[i] = false;
}
if (!rows[i].empty()) {
pq.push({left[i] + rows[i][0], i});
rows[i].pop_front();
}
}
ll gs = 0;
for (ll j = 0; j < r; ++j) {
gs += _i < l - (sum[j] - left[j]) + 1;
}
ans += gs != r;
}
std::cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
3420 KB |
Output is correct |
2 |
Correct |
7 ms |
1192 KB |
Output is correct |
3 |
Correct |
8 ms |
1416 KB |
Output is correct |
4 |
Correct |
22 ms |
3584 KB |
Output is correct |
5 |
Correct |
17 ms |
1864 KB |
Output is correct |
6 |
Correct |
27 ms |
4552 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
33 ms |
5212 KB |
Output is correct |
9 |
Correct |
14 ms |
2140 KB |
Output is correct |
10 |
Correct |
25 ms |
3828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
1128 KB |
Output is correct |
8 |
Correct |
2 ms |
1116 KB |
Output is correct |
9 |
Correct |
1 ms |
1116 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
3420 KB |
Output is correct |
2 |
Correct |
7 ms |
1192 KB |
Output is correct |
3 |
Correct |
8 ms |
1416 KB |
Output is correct |
4 |
Correct |
22 ms |
3584 KB |
Output is correct |
5 |
Correct |
17 ms |
1864 KB |
Output is correct |
6 |
Correct |
27 ms |
4552 KB |
Output is correct |
7 |
Correct |
3 ms |
348 KB |
Output is correct |
8 |
Correct |
33 ms |
5212 KB |
Output is correct |
9 |
Correct |
14 ms |
2140 KB |
Output is correct |
10 |
Correct |
25 ms |
3828 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
2 ms |
1128 KB |
Output is correct |
18 |
Correct |
2 ms |
1116 KB |
Output is correct |
19 |
Correct |
1 ms |
1116 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Runtime error |
96 ms |
262144 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1062 ms |
348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |