Submission #1094572

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10945722024-09-29 23:59:57IzzyAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
296 ms4340 KiB
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
//https://pastebin.com/LckN30bC
// keep values of x + e, x - e; sort by left and then right
int n;
bool compare(const pair<int, int> &a, const pair<int, int> &b) {
if (a.first != b.first) {
return a.first < b.first;
}
return a.second > b.second; // 1 4, 1 3, 1 2
}
int main() {
cin >> n;
vector<pair<int, int>> range(n);
int x, e;
for (int i = 0; i < n; i++) {
cin >> x >> e;
range[i].first = x - e;
range[i].second = x + e;
}
sort(range.begin(), range.end(), compare);
int maximum = -1;
int answer = 0;
for (int i = 0; i < n; i++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...