Submission #722565

# Submission time Handle Problem Language Result Execution time Memory
722565 2023-04-12T10:28:37 Z ymm Roller Coaster Railroad (IOI16_railroad) C++17
0 / 100
253 ms 12836 KB
#include "railroad.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

long long plan_roller_coaster(std::vector<int> s, std::vector<int> t)
{
	s.push_back(1e9+10);
	t.push_back(1);
	int n = s.size();
	set<pii> S;
	Loop (i,0,n)
		S.insert({s[i], i});
	ll ans = 0;
	int p = 1;
	while (S.size()) {
		auto it = S.lower_bound(pii{p, INT_MIN});
		if (it == S.end())
			--it;
		int i = it->second;
		ans += max(0, p - s[i]);
		p = t[i];
		S.erase(it);
	}
	ans += p-1;
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 0 ms 212 KB n = 2
4 Correct 1 ms 256 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Incorrect 0 ms 212 KB answer is not correct: 861315532 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 0 ms 212 KB n = 2
4 Correct 1 ms 256 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Incorrect 0 ms 212 KB answer is not correct: 861315532 instead of 523688153
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 152 ms 12724 KB n = 199999
2 Correct 253 ms 12752 KB n = 199991
3 Correct 153 ms 12712 KB n = 199993
4 Correct 129 ms 9824 KB n = 152076
5 Correct 65 ms 6068 KB n = 93249
6 Correct 160 ms 12832 KB n = 199910
7 Correct 152 ms 12836 KB n = 199999
8 Correct 146 ms 12836 KB n = 199997
9 Correct 151 ms 11036 KB n = 171294
10 Incorrect 100 ms 9004 KB answer is not correct: 1 instead of 0
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB n = 2
2 Correct 0 ms 212 KB n = 2
3 Correct 0 ms 212 KB n = 2
4 Correct 1 ms 256 KB n = 2
5 Correct 0 ms 212 KB n = 2
6 Incorrect 0 ms 212 KB answer is not correct: 861315532 instead of 523688153
7 Halted 0 ms 0 KB -