# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
905218 | Petrix | Advertisement 2 (JOI23_ho_t2) | C++17 | 361 ms | 14244 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<pair<int,int>> v;
bool cmp(pair<int,int> a,pair<int,int> b){
if(a.first!=b.first) return a.first<b.first;
return a.second>b.second;
}
int main()
{
int n,cnt=0,i,curent=-1,a,b;
cin>>n;
for(i=0;i<n;i++){
cin>>a>>b;
v.push_back({a-b,b+a});
}
sort(v.begin(),v.end());
for(i=0;i<v.size();i++){
if(curent<v[i].second){
cnt++;curent=v[i].second;
}
}
cout<<cnt;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |