Submission #862259

#TimeUsernameProblemLanguageResultExecution timeMemory
862259TAhmed33Osumnjičeni (COCI21_osumnjiceni)C++98
0 / 110
1084 ms8160 KiB
#include <bits/stdc++.h> using namespace std; int main () { int n; cin >> n; pair <int, int> arr[n + 1]; for (int i = 1; i <= n; i++) cin >> arr[i].first >> arr[i].second; int q; cin >> q; while (q--) { int l, r; cin >> l >> r; set <int> cur; vector <pair <int, int>> p; for (int i = l; i <= r; i++) { p.push_back(arr[i]); } sort(p.begin(), p.end()); int ans = 0; for (auto [x, y] : p) { if (cur.empty()) { cur.insert(y); ans = max(ans, 1); continue; } auto l = cur.begin(); if (*l >= x) { cur.insert(y); } else { cur.erase(l); cur.insert(y); } ans = max(ans, (int)cur.size()); } cout << ans << '\n'; } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:21:13: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   21 |   for (auto [x, y] : p) {
      |             ^
#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...