제출 #870377

#제출 시각아이디문제언어결과실행 시간메모리
870377Alebn추월 (IOI23_overtaking)C++17
0 / 100
1 ms436 KiB
#include <iostream> #include <vector> #include <algorithm> #define ll long long using namespace std; struct Bus { ll start, speed, arrive; }; ll l, n, x, m; vector<ll> s; vector<Bus> a; bool srt(Bus a, Bus b) { return a.start < b.start; } void init(int el, int en, vector<ll> t, vector<int> w, int ex, int em, vector<int> es) { l = el, n = en, x = ex, m = em; a = vector<Bus>(n), s = vector<ll>(m); for(int i = 0; i < m; i++) s[i] = es[i]; for(ll i = 0; i < n; i++) { a[i].start = t[i]; a[i].speed = w[i]; } sort(a.begin(), a.end(), srt); for(ll i = 0; i < n; i++) { a[i].arrive = max(a[i].start+a[i].speed*l, (i == 0 ? 0 : a[i-1].arrive)); //cout << a[i].start << " " << a[i].speed << " " << a[i].arrive << "\n"; } } ll arrival_time(ll y) { ll le = 0, ri = n, mid, ans = n; while(le<=ri) { mid = (le+ri)/2; if(a[mid].start > y) { ans = mid; ri = mid-1; } else le = mid+1; } //cout << ans << " " << y+x*l << " " << x << " " << l << " " << (ans == 0 ? 0 : a[ans-1].arrive) << "\n"; return max(y+x*l, (ans == 0 ? 0 : a[ans-1].arrive)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...