Submission #899356

#TimeUsernameProblemLanguageResultExecution timeMemory
899356stefanneaguAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
364 ms14048 KiB
#include <bits/stdc++.h> using namespace std;main(){int n,x,y,i;array<int,2>v[500001];cin>>n;for(i=0;i<n;i++)cin>>x>>y,v[i]={x-y,-x-y};sort(v,v+n);x=y=0;for(i=0;i<n;i++)if(y>v[i][1])y=v[i][1],x++;cout<<x;}

Compilation message (stderr)

Main.cpp:2:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;main(){int n,x,y,i;array<int,2>v[500001];cin>>n;for(i=0;i<n;i++)cin>>x>>y,v[i]={x-y,-x-y};sort(v,v+n);x=y=0;for(i=0;i<n;i++)if(y>v[i][1])y=v[i][1],x++;cout<<x;}
      |                     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...