제출 #1143577

#제출 시각아이디문제언어결과실행 시간메모리
1143577crispxxHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
8 / 100
3095 ms42372 KiB
/** * author: a.k * created: idk **/ #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define int long long #define nl '\n' signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<int> a(n); for(auto &u : a) cin >> u; while(m--) { int l, r, k; cin >> l >> r >> k; l--; priority_queue<int> pq; for(int i = l; i < r; i++) pq.emplace(a[i]); bool flag = true; while(!pq.empty()) { int u = pq.top(); pq.pop(); set<int> st; for(int i = r - 1; i >= l; i--) { if(a[i] == u) { auto it = st.upper_bound(k - a[i]); if(it != st.end()) flag = false; break; } if(a[i] < u) st.emplace(a[i]); } if(!flag) break; } cout << flag << nl; } }
#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...