제출 #1363861

#제출 시각아이디문제언어결과실행 시간메모리
1363861weedywelonRoller Coaster Railroad (IOI16_railroad)C++20
0 / 100
39 ms5116 KiB
#include "railroad.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <limits.h>
#include <set>
#include <string>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <deque>
#include <map>
#include <chrono>
#include <random>
#include <bitset>
#include <tuple>
#define SZ(x) int(x.size())
#define FR(i,a,b) for(int i=(a);i<(b);++i)
#define FOR(i,n) FR(i,0,n)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define A first
#define B second
#define mp(a,b) make_pair(a,b)
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef unsigned __int128 U128;
typedef __int128 I128;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
using namespace std;

bool cmp(PII a, PII b){
	return a.B<b.B;
}

LL plan_roller_coaster(vector<int> s, vector<int> t){
	int n=SZ(s);
	vector<PII> a(n);
	FOR(i,n) a[i]=mp(s[i],t[i]);
	
	sort(a.begin(), a.end(), cmp);
	multiset<int> st;
	st.insert(a[0].B);
	
	FR(i,1,n){
		int cur=a[i].A;
		auto it=st.upper_bound(cur);
		if (it==st.begin()) return 1;
		--it;
		
		st.erase(it);
		st.insert(a[i].B);
	}
	return 0;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…