제출 #1022446

#제출 시각아이디문제언어결과실행 시간메모리
1022446AmirAli_H1Roller Coaster Railroad (IOI16_railroad)C++17
0 / 100
57 ms10560 KiB
// In the name of Allah #include <bits/stdc++.h> #include "railroad.h" using namespace std; typedef long long int ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef complex<ld> cld; #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) #define F first #define S second #define pb push_back #define sep ' ' #define endl '\n' #define Mp make_pair #define kill(x) cout << x << '\n', exit(0) #define set_dec(x) cout << fixed << setprecision(x); #define file_io(x,y) freopen(x, "r", stdin); freopen(y, "w", stdout); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxn = 2e5 + 7; const ll oo = 1e18 + 4; int n; ll A1[maxn], A2[maxn]; ll plan_roller_coaster(vector<int> s, vector<int> t) { n = len(s); for (int i = 0; i < n; i++) { A1[i] = s[i]; A2[i] = t[i]; } A1[n] = oo; A2[n] = -oo; n++; ll ans = 0; sort(A1, A1 + n); sort(A2, A2 + n); for (int i = 1; i < n - 1; i++) { ans += max(0ll, A2[i] - A1[i]); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...