제출 #863147

#제출 시각아이디문제언어결과실행 시간메모리
863147denniskimOvertaking (IOI23_overtaking)C++17
19 / 100
4 ms16732 KiB
#include "overtaking.h"
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())

ll n, m, x;
ll LL;
ll w[2010];
ll S[2010][2010];
ll spd[2010];
vector<pll> qry;

void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> SS)
{
	x = X, LL = L;
	
	for(ll i = 0 ; i < N ; i++)
	{
		if(W[i] <= X)
			continue;
		
		spd[++n] = W[i] - X;
		S[1][n] = T[i];
	}
	
	for(ll i = 0 ; i < M ; i++)
		w[++m] = SS[i];
	
	for(ll i = 1 ; i < m ; i++)
	{
		vector<pll> vv;
		
		for(ll j = 1 ; j <= n ; j++)
			vv.push_back({S[i][j], j});
		
		sort(vv.begin(), vv.end());
		
		ll maxx = 0;
		ll dist = w[i + 1] - w[i];
		
		for(auto &j : vv)
		{
			S[i + 1][j.se] = max(S[i][j.se] + dist * spd[j.se], maxx);
			maxx = max(maxx, S[i + 1][j.se]);
		}
	}
	
	for(ll i = 1 ; i < m ; i++)
	{
		vector<pll> vv;
		
		for(ll j = 1 ; j <= n ; j++)
			vv.push_back({S[i][j], S[i + 1][j]});
		
		sort(vv.begin(), vv.end());
		reverse(vv.begin(), vv.end());
		
		for(ll j = 0 ; j < n ; j++)
			qry.push_back(vv[j]);
	}
}

ll arrival_time(ll Y)
{
	for(ll i = 1 ; i < m ; i++)
	{
		ll maxx = 0;
		
		for(ll j = 1 ; j <= n ; j++)
		{
			if(Y > S[i][j])
				maxx = max(maxx, S[i + 1][j]);
		}
		
		Y = max(Y, maxx);
	}
	
	return Y + x * LL;
}
#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...