| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 951745 | MohammadAbduljalil | Fuel Station (NOI20_fuelstation) | C++17 | 275 ms | 25960 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fast_input_output() ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
typedef long long ll;
long long const mod = 1e9 + 7;
ll n, d; vector<vector<ll>> v;
bool check(ll f) {
for (int i = 0; i < n; i++) {
ll x = v[i][0], a = v[i][1], b = v[i][2];
if (f < x - (i ? v[i - 1][0] : 0)) return false;
if (f <= b) f += a;
}
return (f >= d - v.back()[0]);
}
int main() {
fast_input_output();
cin >> n >> d; v.resize(n, vector<ll>(3, 0));
for (int i = 0; i < n; i++) cin >> v[i][0] >> v[i][1] >> v[i][2];
sort(v.begin(), v.end());
ll l = v.front().front(), r = 1000000000ll, mid, res = INT_MAX;
while (l <= r) {
mid = ((l + r) >> 1);
if (check(mid)) {
r = mid - 1;
res = mid;
} else l = mid + 1;
}
cout << res;
return 0;
}| # | 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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
