Submission #1129893

#TimeUsernameProblemLanguageResultExecution timeMemory
1129893c0det1gerAdvertisement 2 (JOI23_ho_t2)C++20
100 / 100
155 ms12368 KiB
#include <bits/stdc++.h> #pragma GCC optimize ("O3") #pragma GCC target ("sse4") using namespace std; #define int long long #define double long double #define codetiger_orz cin.tie(0);cin.sync_with_stdio(0); signed main() { codetiger_orz int n; cin >> n; vector<pair<int, int>> v(n); for (int i = 0; i < n; i++){ cin >> v[i].first >> v[i].second; v[i] = {v[i].first + v[i].second, v[i].second - v[i].first}; } sort(v.begin(), v.end()); stack<int> stk; for (int i = 0; i < n; i++){ while (!stk.empty() && stk.top() <= v[i].second){ stk.pop(); } stk.push(v[i].second); } cout << stk.size() << "\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...