Submission #1132271

#TimeUsernameProblemLanguageResultExecution timeMemory
1132271AgageldiHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
34 / 100
3094 ms10232 KiB
/* ID: agageld1 LANG: C++17 TASK: */ #include <bits/stdc++.h> using namespace std; #define ll long long #define N 4000005 #define ff first #define ss second #define pb push_back #define sz(s) (int)s.size() #define rep(c, a, b) for(c = a; c <= b; c++) //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ll n, t, a[N], l, r, x, mx, q; int main () { ios::sync_with_stdio(0);cin.tie(0); cin >> n >> q; for(int i= 1;i<=n;i++) { cin >> a[i]; } for(int i= 1;i<=q;i++) { cin >> l >> r >> x; if(l == r) { cout << "1\n"; continue; } mx = a[l]; bool tr = 0; for(int j = l + 1; j <= r; j++) { if(mx > a[j] && mx + a[j] > x) { tr = 1; break; } mx = max(mx,a[j]); } if(tr) cout << "0\n"; else cout << "1\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...