제출 #602491

#제출 시각아이디문제언어결과실행 시간메모리
6024918e7Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
98 ms9780 KiB
#include "railroad.h"
//Challenge: Accepted
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r){
	while (l != r) cout << *l << " ", l++;
	cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 200005
#define pii pair<int, int>
#define ff first
#define ss second
const ll inf = 1LL<<60;
int p[maxn];
long long plan_roller_coaster(std::vector<int> S, std::vector<int> T) {
    int n = (int) S.size();
	vector<pii> a;
	for (int i = 0;i < n;i++) a.push_back({S[i], T[i]});	
	sort(a.begin(), a.end());
	for (int i = 0;i < n;i++) {
		int ind = lower_bound(a.begin(), a.end(), make_pair(T[i], 0)) - a.begin();			
		p[ind]++;
	}		
	p[0]++;
	ll ans = 0;
	for (int i = 1;i < n;i++) p[i] += p[i-1];
	for (int i = 0;i < n;i++) {
		if (p[i] <= i) ans = 1;
	}
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...