Submission #599912

#TimeUsernameProblemLanguageResultExecution timeMemory
599912cheissmartRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
99 ms9836 KiB
#include "railroad.h" #include <bits/stdc++.h> #define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0); #define F first #define S second #define V vector #define PB push_back #define EB emplace_back #define MP make_pair #define SZ(v) int((v).size()) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair<int, int> pi; typedef V<int> vi; const int INF = 1e9 + 7; ll plan_roller_coaster(vi s, vi t) { int n = SZ(s); V<array<int, 3>> tt; tt.PB({-INF, -1, -1}); tt.PB({INF, 1, -2}); for(int i = 0; i < n; i++) { tt.PB({s[i], -1, i}); tt.PB({t[i], 1, i}); } sort(ALL(tt)); ll ss = 0; for(int i = 0; i < SZ(tt); i++) { ss += tt[i][1]; if(ss > 0) return 0; if(ss == 0 && i + 2 < SZ(tt) && tt[i + 1][2] == tt[i + 2][2]) return 0; } return 330; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...