제출 #1066716

#제출 시각아이디문제언어결과실행 시간메모리
1066716Gromp15추월 (IOI23_overtaking)C++17
39 / 100
3564 ms568 KiB
#include <bits/stdc++.h> #define ll long long #define ar array #define all(x) x.begin(), x.end() #define sz(x) (int)x.size() #include "overtaking.h" using namespace std; template<typename T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template<typename T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } int L, N, X, M; vector<ll> T; vector<int> W, S; void init(int _L, int _N, std::vector<long long> _T, std::vector<int> _W, int _X, int _M, std::vector<int> _S) { L = _L; N = _N; T = _T; W = _W; X = _X; M = _M; S = _S; W.push_back(X); } long long arrival_time(long long Y) { vector<ar<ll, 2>> buses; for (int i = 0; i < N; i++) buses.push_back({T[i], i}); buses.push_back({Y, N}); for (int i = 0; i < M - 1; i++) { // go from here to next vector<ar<ll, 3>> ints; for (auto [x, y] : buses) { ints.push_back({x, x + (ll)W[y] * (S[i+1] - S[i]), y}); } sort(all(ints)); ll to = 0; vector<ar<ll, 2>> buses2; for (auto [l, r, idx] : ints) { ckmax(to, r); buses2.push_back({to, idx}); } swap(buses, buses2); } for (auto [x, y] : buses) if (y == N) return x; 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...