| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1072685 | _rain_ | Lasers (NOI19_lasers) | C++14 | 126 ms | 13780 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fixbug false
void SETIO(string name = ""){
if (name=="") return;
freopen((name+".inp").c_str(),"r",stdin);
// freopen((name+".out").c_str(),"w",stdout);
return;
}
int numrow , L;
#define fi first
#define se second
int main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
SETIO("");
cin >> L >> numrow;
vector<pair<int,int>> ev;
for (int i = 1; i <= numrow; ++i){
int x; cin >> x;
vector<int> a(x+2,0) , pre(x+2,0);
for (int j = 1; j <= x; ++j) {
cin >> a[j];
pre[j] = pre[j - 1] + a[j];
}
for (int j = 1; j <= x; ++j){
int jump = a[j];
int l = pre[j - 1] + 1 , r = L - (pre[x] - pre[j]);
if (l + jump - 1 < r - jump + 1) continue;
ev.push_back({min(L+1,l + jump) , -1});
ev.push_back({max(1,r - jump + 1) , 1});
if (fixbug){
cout << "FIXBUG\n";
cout << i << ' ' << j << ' ' << l << ' ' << r << '\n';
}
}
}
sort(ev.begin(),ev.end());
int leftmost = -1 , sum = 0 , ans= 0;
for (int i = 0; i < ev.size(); ++i){
if (leftmost == -1) leftmost = ev[i].fi;
sum += ev[i].se;
if (sum==0){
if (fixbug){
cout << "DEBUG\n";
cout << ev[i].fi << ' ' << ev[i].se << '\n';
}
ans += ev[i].fi - leftmost ;
leftmost = -1;
}
}
cout << 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... | ||||
