제출 #899356

#제출 시각아이디문제언어결과실행 시간메모리
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;}

컴파일 시 표준 에러 (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...