이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "railroad.h"
#include <bits/stdc++.h>
using namespace std;
#define eb emplace_back
#define x first
#define y second
using pp=pair<int,int>;
using ll=long long;
map<int,int> df;
const int inf = int(1e9) + 10;
long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) {
int n = s.size();
for(int i=0; i<n; ++i) {
df[s[i]] += -1;
df[t[i]] += +1;
}
df[inf] += -1;
int lev = 1, last = 0;
ll ans = 0;
for(auto tmp:df) {
if(lev < 0) {
ans += (tmp.x - last) * 1ll * (-lev);
}
last = tmp.x;
lev += tmp.y;
}
return ans;
}
# | 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... |