| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 224619 | Nightlight | Lasers (NOI19_lasers) | C++14 | 192 ms | 10024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define l first
#define r second
using namespace std;
int L, N, M;
int pos[500005];
pii ran[500005];
int ans;
int main() {
// freopen("inp", "r", stdin);
scanf("%d %d", &L, &N);
int l, r, p = 0;
for(int i = 1; i <= N; i++) {
scanf("%d", &M);
for(int j = 1; j <= M; j++) {
scanf("%d", &pos[j]);
pos[j] += pos[j - 1];
}
for(int j = 1; j <= M; j++) {
l = L - (pos[M] - pos[j - 1]) + 1, r = pos[j];
if(l <= r) {
ran[++p] = {l, r};
}
}
}
sort(ran + 1, ran + p + 1);
int ln = 0, rn = -1;
for(int i = 1; i <= p; i++) {
if(ran[i].l > rn) {
ans += rn - ln + 1;
ln = ran[i].l;
rn = ran[i].r;
}else {
rn = max(ran[i].r, rn);
}
}
ans += rn - ln + 1;
printf("%d\n", ans);
}
컴파일 시 표준 에러 (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... | ||||
