이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
//#define int long long
#define endl '\n'
#define pii pair<int,int>
#define vint vector<int>
#define vll vector<long long>
#define vpii vector<pii>
#define pb push_back
#define se second
#define fi first
#define all(x) x.begin(), x.end()
#define graph vector<vector<int>>
using namespace std;
const int N = (int)2e5 + 69;
const int mod = (int)1e4 + 7;
const int naser = 3999, tourist = 3816;
int power(int a, int b) { int ans = 1; while (b) { if (b % 2) ans *= a; a *= a; b /= 2; } return ans; }
int n, x, m,l;
long long y;
vint w, s;
vll t;
void init(int L, int N, vll T, vint W, int X, int M, vint S) {
l = L;
n = N;
x = X;
m = M;
t = T;
w = W;
s = S;
}
long long arrival_time(long long Y) {
y = Y;
int ans = y + l * x;
if (t[0] >= y || w[0] >= x || (t[0] + l*w[0]) <= (y + l * x))
return ans;
int cross = (y - t[0]) / (w[0] - x) + ((y - t[0]) % (w[0] - x) != 0);
int idx = lower_bound(all(s), cross) - s.begin();
ans = t[0] + s[idx] * w[0] + (l - s[idx]) * x;
return y + l * x;
}
/*int32_t main() {
init(6, 4, { 20, 10, 40, 0 }, { 5, 20, 20, 30 }, 10, 4, { 0, 1, 3, 6 });
//init(6, 2, { 10, 20 }, { 5, 3 }, 2, 2, { 0, 6 });
while (naser > tourist) {
int y;
cin >> y;
cout << arrival_time(y) << endl;
}
}*/
# | 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... |