Submission #600511

#TimeUsernameProblemLanguageResultExecution timeMemory
600511Yazan_AlattarRoller Coaster Railroad (IOI16_railroad)C++14
30 / 100
165 ms15764 KiB
#include <bits/stdc++.h> using namespace std; 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; const ll mod = 1e9 + 7; const double pi = acos(-1); const double eps = 1e-6; const int dx[] = {0, -1, 0, 1}, dy[] = {1, 0, -1, 0}; const int block = 320; 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...