제출 #495248

#제출 시각아이디문제언어결과실행 시간메모리
495248nameIsJatinBest Place (NOI17_bestplace)C++17
100 / 100
37 ms3924 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define all(x) x.begin(), x.end() ll n; int oned(vector<ll> d) { if (n%2 == 1) { int mid = floor(n/2); return d[mid]; } else { int mid = floor(( (n/2) + (n/2) -1 )/2); return d[mid]; } return 0; } int solver() { cin>>n ; vector<ll> x(n), y(n); for(int i = 0; i< n; i++) { cin>> x[i] >> y[i]; } sort(all(x)); sort(all(y)); if (equal(x.begin()+1 , x.end(), x.begin())) { cout<< x[0] <<" "<< oned(y) << "\n"; return 0; } else if(equal(y.begin()+1, y.end(), y.begin())) { cout<< oned(x)<< " "<< y[0] << "\n"; return 0; } if (n%2 == 1) { ll mX = x[n/2]; ll mY = y[n/2]; cout<< mX << " " << mY << "\n"; return 0; } else { int mid = floor(( (n/2) + (n/2) -1 )/2); ll mX = x[mid]; ll mY = y[mid]; cout<< mX << " " << mY << "\n"; return 0; } return 0; } int main() { ios::sync_with_stdio(0); cin.tie(0); solver(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...