이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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< pair<pll, ll> > vv;
for(ll j = 1 ; j <= n ; j++)
vv.push_back({{S[i][j], spd[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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |