Submission #842645

#TimeUsernameProblemLanguageResultExecution timeMemory
842645mindiyakOvertaking (IOI23_overtaking)C++17
19 / 100
5 ms540 KiB
#include "overtaking.h" #pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pi; typedef pair<ll, ll> pl; typedef pair<ld, ld> pd; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<vector<int>> vvi; typedef vector<ld> vd; typedef vector<ll> vl; typedef vector<pi> vpi; typedef vector<pl> vpl; #define FOR(i, a, b) for (ll i = a; i < (b); i++) #define F0R(i, a) for (ll i = 0; i < (a); i++) #define FORd(i, a, b) for (ll i = (b)-1; i >= a; i--) #define F0Rd(i, a) for (ll i = (a)-1; i >= 0; i--) #define trav(a, x) for (auto &a : x) #define uid(a, b) uniform_int_distribution<int>(a, b)(rng) #define len(x) (int)(x).size() #define mp make_pair #define pb push_back #define fst first #define nl endl #define sec second #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define ins insert const int MOD = 1000000007; const int MX = INT_MAX; const int MN = INT_MIN; ll l,n,x,m; vl t,s; vector<pair<ll,ll>> w; vector<vector<ll>> pos(1003,vl()); 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;x=X;m=M; t=T; for(int i=0;i<N;i++)w.push_back({(ll)W[i],i}); for(int a:S)s.push_back(a); FOR(i,0,M){ FOR(j,0,N){ int a = w[j].second; if(pos[a].size() == 0) pos[a].push_back(t[a]); else{ pos[a].push_back(pos[a][pos[a].size()-1] + (S[i]-S[i-1])*w[j].first); } } } return; } long long arrival_time(long long Y) { ll time = Y; FOR(i,1,m){ ll nextTime = time+(s[i]-s[i-1])*x; FOR(j,0,n){ if(pos[j][i-1]<time and pos[j][i]>time){ nextTime = max(nextTime,pos[j][i]); } } time = nextTime; } return time; }
#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...