제출 #866433

#제출 시각아이디문제언어결과실행 시간메모리
866433yeediotAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
139 ms18108 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define F first #define S second #define all(x) x.begin(),x.end() #define pii pair<int,int> #define pb push_back #define sz(x) (int)(x.size()) #define chmin(x,y) x=min(x,y) #define chmax(x,y) x=max(x,y) #define vi vector<int> #define vp vector<pii> #define vvi vector<vi> //Don't open the standings during contests. void setIO(string s) { freopen((s + ".in").c_str(), "r", stdin); freopen((s + ".out").c_str(), "w", stdout); } bool cmp(pii a,pii b){ if(b.S!=a.S)return a.S>b.S; return a.F>b.F; } signed main(){ ios::sync_with_stdio(0); cin.tie(0);cout.tie(0); int n; cin>>n; vector<pii>v; for(int i=0;i<n;i++){ int a,b; cin>>a>>b; v.pb({b-a,b+a}); } sort(all(v),cmp); int mx=-8e18; int ans=0; for(int i=0;i<n;i++){ //cout<<v[i].F<<' '<<v[i].S<<'\n'; if(v[i].F>mx){ mx=v[i].F; ans++; } } cout<<ans<<'\n'; } /* input: if(x_i>x_j) e_j-x_j<=e_i-x_i */

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void setIO(std::string)':
Main.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen((s + ".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     freopen((s + ".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...