# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
830306 | exodus_ | Lasers (NOI19_lasers) | C++14 | 256 ms | 9984 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define se second
#define fi first
using namespace std;
const int nmax = 5*1e5+5;
int lenwall[nmax];
vector<pair<int,int>>blck;
int main() {
int L,R,X;
int maxlen = 0;
cin >> L >> R;
for(int i=1; i<=R; i++) {
cin >> X;
int le=0;
int ri=L;
for(int j=1; j<=X; j++) {
cin >> lenwall[j];
le+=lenwall[j];
}
le-=lenwall[X];
for(int k=X; k>=1; k--) {
int l=le;
int r=le+lenwall[k];
int lt=ri-lenwall[k];
int rt=ri;
if(max(l,lt) < min(r,rt)) blck.push_back({max(l,lt), min(r,rt)});
if(k!=1) le-=lenwall[k-1];
ri-=lenwall[k];
}
}
sort(blck.begin(), blck.end());
int ans=0;
int right=0, left=0;
for(int i=0; i<blck.size(); i++) {
if(right<blck[i].fi) {
ans+=(right-left);
left = blck[i].fi;
right = blck[i].fi;
}
right = max(right, blck[i].se);
}
ans+=(right-left);
cout << ans << endl;
return 0;
}
컴파일 시 표준 에러 (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... |