| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1305269 | andrei_iorgulescu | Roller Coaster Railroad (IOI16_railroad) | C++20 | 372 ms | 25268 KiB |
#include <bits/stdc++.h>
#include "railroad.h"
using namespace std;
using ll = long long;
int n, s[200005], t[200005];
void normalize()
{
vector<int> vls;
for (int i = 1; i <= n; i++)
vls.push_back(s[i]), vls.push_back(t[i]);
sort(vls.begin(), vls.end());
int posnorma = 0;
map<int, int> norma;
for (auto it : vls)
if (!norma[it])
norma[it] = ++posnorma;
for (int i = 1; i <= n; i++)
s[i] = norma[s[i]], t[i] = norma[t[i]];
}
ll plan_roller_coaster(vector<int> S, vector<int> T)
{
n = S.size();
for (int i = 1; i <= n; i++)
s[i] = S[i - 1], t[i] = T[i - 1];
normalize();
vector<int> mars(2 * n + 5);
for (int i = 1; i <= n; i++)
{
mars[t[i]]++;
mars[s[i]]--;
}
for (int i = 1; i <= 2 * n + 3; i++)
{
mars[i] += mars[i - 1];
if (mars[i] <= -2)
return 1ll;
}
for (int i = 1; i <= n; i++)
{
if (s[i] >= t[i] and mars[s[i]] == -1)
return 1ll;
}
return 0ll;
}
컴파일 시 표준 에러 (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... | ||||
