제출 #1173345

#제출 시각아이디문제언어결과실행 시간메모리
1173345TsaganaMarathon Race 2 (JOI24_ho_t3)C++20
7 / 100
0 ms328 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; void solve () { int n, l; cin >> n >> l; vector<int> a(n); for (auto &i: a) cin >> i; sort(all(a)); int c1 = 0, c2 = 0; for (int i = 1; i < n; i++) { c1 += (a[i] - a[i-1]) * (i + 1); c2 += (a[i] - a[i-1]) * (n + 1 - i); } int q; cin >> q; while (q--) { int s, e, t; cin >> s >> e >> t; if (min(abs(s - a[0]) + abs(e - a[n-1]) * (n + 1) + c1, abs(s - a[n-1]) + abs(e - a[0]) * (n + 1) + c2) + n <= t) cout << "Yes\n"; else cout << "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...