Submission #871334

#TimeUsernameProblemLanguageResultExecution timeMemory
871334LibRoller Coaster Railroad (IOI16_railroad)C++14
30 / 100
130 ms18372 KiB
#include <bits/stdc++.h> using namespace std; //stolen from https://oj.uz/submission/600511. Testing to see whether it works or not. typedef long long ll; typedef unsigned long long ull; #define F first #define S second #define pb push_back #define endl "\n" #define all(x) x.begin(), x.end() const int M = 100007; const ll inf = 1e9; const ll INF = 1e18; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t){ int n = (int) s.size(); vector < pair <int,int> > v; for(int i = 0; i < n; ++i) v.pb({t[i], s[i]}); sort(all(v)); set < pair <int,int> > rem; for(int i = 0; i < n; ++i) rem.insert({v[i].S, i}); for(int i = 0; i < n - 1; ++i){ auto it = rem.lower_bound({v[i].F, -1}); if(it == rem.end()) return 1; if((*it).S == i) ++it; if(it == rem.end()) return 1; rem.erase(it); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...