Submission #798718

#TimeUsernameProblemLanguageResultExecution timeMemory
798718tlnk07Osumnjičeni (COCI21_osumnjiceni)C++17
0 / 110
1085 ms1956 KiB
#include<bits/stdc++.h> using namespace std; long long n, q, x, y, cnt = 0; pair<int, int> a[200001]; bool check[200001]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> n; for(int i = 1; i <= n; ++i) cin >> a[i].first >> a[i].second; sort(a + 1, a + n + 1); cin >> q; while(q--) { cin >> x >> y; for(int i = x; i <= y; ++i) { if(check[i]) continue; pair<int, int> temp = a[i]; for(int j = i + 1; j <= y; ++j) { if(a[j].first > temp.second) { temp = a[j]; check[j] = true; } } ++cnt; } cout << cnt << "\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...