제출 #1063852

#제출 시각아이디문제언어결과실행 시간메모리
1063852ProtonDecay314추월 (IOI23_overtaking)C++17
0 / 100
0 ms348 KiB
#include "overtaking.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; typedef vector<vpi> vvpi; typedef vector<vpll> vvpll; typedef vector<bool> vb; typedef vector<vb> vvb; typedef short int si; typedef vector<si> vsi; typedef vector<vsi> vvsi; #define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); #define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++) #define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--) #define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++) #define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--) #define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci #define fi first #define se second #define pb push_back #define INF(type) numeric_limits<type>::max() #define NINF(type) numeric_limits<type>::min() #define TCASES int t; cin >> t; while(t--) struct bus { ll v; ll s; ll e; }; typedef vector<bus> vbu; typedef vector<vbu> vvbu; ll x; vi s; ll n; ll m; vbu cur_buses; vvbu bus_configs; void init(int L, int N, vll T, vi W, int X, int M, vi S) { // ! No need to clear variables! This procedure is only called once :)) LI(i, 0, N) { if(W[i] > X) { cur_buses.pb({W[i] - X, T[i], T[i]}); } } n = cur_buses.size(); x = X; s = S; m = M; LI(i, 0, M) { vbu bus_configs_r; bus_configs.pb(bus_configs_r); } // Learning: vector assignment in C++ // implicitly calls the copy constructor sort(cur_buses.begin(), cur_buses.end(), [](bus& b1, bus& b2) {return b1.e < b2.e || (b1.e == b2.e && b1.v < b2.v);}); bus_configs[0] = cur_buses; L(i, 1, M) { // For each sorting station, simulate the advance of the buses sort(cur_buses.begin(), cur_buses.end(), [](bus& b1, bus& b2) {return b1.e < b2.e || (b1.e == b2.e && b1.v < b2.v);}); L(j, 0, n) cur_buses[j].s = cur_buses[j].e; ll max_t = 0ll; L(j, 0, n) { max_t = max(max_t, cur_buses[j].s + cur_buses[j].v * (S[i] - S[i - 1ll])); cur_buses[j].e = max_t; } bus_configs[i] = cur_buses; } return; } ll arrival_time(ll Y) { // for each bus whose arrival time is less than the current, get the maximum time ll cur_pos = Y; L(i, 0ll, m) { ll ds = s[i] - s[i - 1ll]; ll max_t = cur_pos + x * ds; L(j, 1ll, n) { if(bus_configs[i][j].s < cur_pos) { max_t = max(max_t, bus_configs[i][j].e); } } cur_pos = max_t; } return cur_pos; }
#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...