Submission #1173480

#TimeUsernameProblemLanguageResultExecution timeMemory
1173480TsaganaMarathon Race 2 (JOI24_ho_t3)C++20
0 / 100
0 ms320 KiB
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define int long long #define pq priority_queue #define eb emplace_back #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define F first #define S second using namespace std; vector<int> a; int n, en, mn; void print(vector<int> v) { for (auto i: v) cout << i << ' '; cout << '\n'; } 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 () { int l; cin >> n >> l; 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); cout << (mn <= t ? "YES\n" : "NO\n"); } } signed main() {IOS solve(); return 0;}
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...