| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1182844 | william889 | Marathon Race 2 (JOI24_ho_t3) | C++20 | 0 ms | 320 KiB |
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
using namespace std;
vector<int> a;
int n, en, mn;
int find(int x, int c, int y, int t) {
return t + (c + 1) * abs(x - y);
}
void calc(int x, int l, int r, int c, int t) {
if (t >= mn) return;
if (c == n) {
mn = min(mn, find(x, c, en, t));
return;
}
if (r < l) return;
calc(a[l], l + 1, r, c + 1, find(x, c, a[l], t) + 1);
calc(a[r], l, r - 1, c + 1, find(x, c, a[r], t) + 1);
}
void solve() {
cin >> n;
a = vector<int>(n);
for (auto &i: a) cin >> i;
sort(all(a));
int q; cin >> q;
while (q--) {
int s, t;
cin >> s >> en >> t;
mn = 2e18;
calc(s, 0, n-1, 0, 0);
if (mn <= t)
cout << "Yes\n";
else
cout << "No\n";
}
}
signed main() {
solve();
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
