# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
645390 |
2022-09-27T02:41:04 Z |
gun_gan |
Lasers (NOI19_lasers) |
C++17 |
|
139 ms |
55316 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
int l, r, curr[N], sum[N];
vector<int> s[2 * N], pt;
multiset<int> S;
map<int, vector<int>> M;
int main() {
cin.tie(0); ios_base::sync_with_stdio(0);
cin >> l >> r;
int ans = 0;
for(int i = 0; i < r; i++) {
int x; cin >> x;
for(int j = 0; j < x; j++) {
int p; cin >> p;
sum[i] += p;
M[sum[i]].push_back(i);
pt.push_back(sum[i]);
}
S.insert(sum[i]);
}
sort(pt.begin(), pt.end());
pt.erase(unique(pt.begin(), pt.end()), pt.end());
int last = 0;
for(auto [x, v] : M) {
if(l - x < *S.rbegin()) ans += x - last;
for(auto j : v) {
S.erase(S.find(sum[j] - curr[j]));
curr[j] = x;
S.insert(sum[j] - curr[j]);
}
last = x;
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
23764 KB |
Output is correct |
3 |
Incorrect |
13 ms |
23892 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
23764 KB |
Output is correct |
3 |
Incorrect |
13 ms |
23892 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
139 ms |
55316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
23764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
139 ms |
55316 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
23764 KB |
Output is correct |
2 |
Correct |
13 ms |
23764 KB |
Output is correct |
3 |
Incorrect |
13 ms |
23892 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |