Submission #789883

#TimeUsernameProblemLanguageResultExecution timeMemory
789883Minindu206Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
69 ms9900 KiB
#include "railroad.h" #include <bits/stdc++.h> using namespace std; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { #define int long long int n = (int)s.size(); vector<pair<int, int>> ss, tt; for(int i=0;i<n;i++) { tt.push_back({t[i], i}); ss.push_back({s[i], i}); } sort(ss.rbegin(), ss.rend()); sort(tt.rbegin(), tt.rend()); int i = 0, j = 0; while(i < n) { if(ss[i].second != tt[j].second) { if(tt[j].first > ss[i].first) return 999; } else if(i != n - 1) { if(tt[j].first > ss[i + 1].first) return 999; } i++, j++; } 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...