| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 289401 | Saboon | Roller Coaster Railroad (IOI16_railroad) | C++17 | 227 ms | 10508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 4e5 + 10;
int go[maxn], back[maxn];
ll plan_roller_coaster(vector<int> s, vector<int> t){
int n = (int)s.size();
vector<int> C;
for (int i = 0; i < n; i++)
C.push_back(s[i]), C.push_back(t[i]);
sort(C.begin(),C.end());
C.resize(unique(C.begin(),C.end())-C.begin());
ll ret = 0;
for (int i = 0; i < n; i++){
int pre = lower_bound(C.begin(),C.end(),s[i]) - C.begin();
int nex = lower_bound(C.begin(),C.end(),t[i]) - C.begin();
if (pre < nex)
go[pre] ++, go[nex] --;
if (nex < pre)
back[nex+1] ++, back[pre+1] --;
}
for (int i = 1; i < C.size(); i++)
go[i] += go[i-1], back[i] += back[i-1];
for (int it = 0; it+1 < C.size(); it++){
int i = C[it], j = C[it+1];
ret += (j-i)*max(0,go[it]-back[it+1]-1);
}
return ret;
}
컴파일 시 표준 에러 (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... | ||||
