# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
815957 | andecaandeci | Lasers (NOI19_lasers) | C++17 | 274 ms | 16764 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int presum[500005];
vector<pair<int, int>> segment;
signed main() {
int l, r, x, w;
cin >> l >> r;
for (int i = 1; i <= r; i++) {
cin >> x;
for (int j = 1; j <= x; j++) {
cin >> w;
presum[j] = presum[j-1] + w;
}
int gap = l - presum[x];
for (int j = 1; j <= x; j++) {
if (presum[j-1] + gap + 1 <= presum[j]) {
segment.push_back({presum[j-1] + gap + 1, 1});
segment.push_back({presum[j], 2});
}
}
}
// Line Sweep
sort(segment.begin(), segment.end());
int count = 0, save, ans = 0;
for (auto i: segment) {
if (i.second == 1) {
if (count == 0) save = i.first;
count++;
} else {
count--;
if (count == 0) ans += (i.first-save+1);
}
}
cout << ans << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |