제출 #499751

#제출 시각아이디문제언어결과실행 시간메모리
499751The_SamuraiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++98
17 / 100
3068 ms8140 KiB
#include <bits/stdc++.h> #define fcc ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define sqr(a) (a) * (a) #define all(x) x.begin(), x.end() #define rall(x) x.rebgin(), x.rend() #define pb push_back #define mp make_pair #define int long long #define ff first #define ss second #define endl "\n" using namespace std; typedef long double ld; typedef pair<int,int> pii; typedef vector<int> vi; typedef set<int> si; int a[500009], b[500009]; void solve() { int n, m, l, r, k; cin >> n >> m; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; } a[0] = 0; while (m--) { cin >> l >> r >> k; int ans = 0, leftmax = 0; for (int i = l; i <= r; i++) { if (leftmax > a[i]) { ans = max(ans, leftmax + a[i]); } leftmax = max(leftmax, a[i]); } if (ans <= k) { cout << "1\n"; } else { cout << "0\n"; } } } signed main() { fcc; int t = 1; // cin >> t; while (t--) { solve(); cout << '\n'; } }
#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...