제출 #789885

#제출 시각아이디문제언어결과실행 시간메모리
789885Minindu206Roller Coaster Railroad (IOI16_railroad)C++14
0 / 100
76 ms9904 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 > 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...