Submission #797888

#TimeUsernameProblemLanguageResultExecution timeMemory
7978881binAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
129 ms14084 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; const int NMAX = 5e5 + 5; int n, x, y; vector<pair<int, int>> v; stack<pair<int, int>> st; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for(int i = 0; i < n; i++) cin >> x >> y, v.emplace_back(x, y); sort(all(v)); for(int i = 0; i < n; i++){ auto&[x, y] = v[i]; while(st.size() && y - st.top().second >= x - st.top().first) st.pop(); if(st.empty() || st.top().second - y < x - st.top().first) st.emplace(x, y); } cout << st.size(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:19:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   19 |         auto&[x, y] = v[i];
      |              ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...