제출 #783895

#제출 시각아이디문제언어결과실행 시간메모리
783895AndreyAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
132 ms17260 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,a,b,big = -1,br = 0; cin >> n; vector<pair<int,int>> haha(0); priority_queue<int> idk; for(int i = 0; i < n; i++) { cin >> a >> b; haha.push_back({a,b}); } sort(haha.begin(),haha.end()); for(int i = 0; i < n; i++) { if(haha[i].first+haha[i].second > big) { big = haha[i].first+haha[i].second; br++; while(!idk.empty() && idk.top() >= haha[i].first-haha[i].second) { idk.pop(); br--; } idk.push(haha[i].first-haha[i].second); } } cout << br; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...