답안 #293683

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
293683 2020-09-08T09:47:01 Z VodkaInTheJar Roller Coaster Railroad (IOI16_railroad) C++14
0 / 100
214 ms 29824 KB
#include <bits/stdc++.h>
#include "railroad.h"
 
using namespace std;

const long long inf = 1e18;

long long plan_roller_coaster(vector <int> s, vector <int> t)
{
	int n = (int)s.size();
	
	long long ans = inf; 
	for (int i = 0; i < n; i++)
	{
		multiset <pair <int, int> > se;
		for (int j = 0; j < n; j++)
		if (j != i)
		se.insert({s[j], t[j]});
		
		long long curr_ans = 0;
		int curr_t = t[i];
		while (!s.empty())
		{
			auto it = se.lower_bound({curr_t, 0});
			if (it == se.end())
			it--;
			
			curr_ans += max(0, curr_t - it->first);
			curr_t = it->second;
			se.erase(it);
		}
		
		ans = min(ans, curr_ans);
	}
	
	return ans; 
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 214 ms 29824 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -