Submission #464780

#TimeUsernameProblemLanguageResultExecution timeMemory
464780avaneeshk098Best Place (NOI17_bestplace)C++17
100 / 100
43 ms3812 KiB
#include <bits/stdc++.h> #define ff first #define int long long int #define ss second #define pb push_back #define mp make_pair #define mt make_tuple #define pii pair<int,int> #define vi vector<int> #define mii map<int,int> #define pqb priority_queue<int> #define max_size 100000000 #define pqs priority_queue<int,vi,greater<int> > #define setbits(x) __builtin_popcountll(x) #define mod (int)1e9+7 #define w(t) int t; cin >> t; while(t--) #define inf 1e18 //#define ps(x,y) fixed<<setprecision(y)<<x #define mk(arr,n,type) type *arr=new type[n]; #define range(a,b) substr(a,b-a+1) #define mina(a,b,c) min(a, min(b, c)) #define maxa(a,b,c) max(a, max(b, c)) #define sz(a) (int)a.size() #define endl '\n' #define trace(x) cerr<<#x<<": "<<x<<" "<<endl; #define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define FOR(x,y) for(int i = x; i < y; i++) using namespace std; bool sortbysecond(const pair<int,int> &a, const pair<int,int> &b){ return (a.second > b.second); } int64_t ceil_div(int64_t a, int64_t b) {if(a%b != 0){ return ((a/b)+1);} else{ return (a/b);}} double max(double a, double b){ if(a >= b){ return a; } else{ return b; } } double min(double a, double b){if(a <= b){return a;} else{return b; }} bool modd(double a, double b){if(floor(a/b) == ceil(a/b)){return true;} return false;} bool stringsort(const string &a, const string &b){return a.length() > b.length();} bool specsort(const pair<long double,int> &a, const pair<long double,int> &b){ if(a.first == b.first){ return a.second > b.second; } else return a.first > b.first; } void solve() { int n; cin >> n; vi x(n), y(n); FOR(0,n){ cin >> x[i]; cin >> y[i];} sort(x.begin(), x.end()); sort(y.begin(), y.end()); if(n%2 == 0){ cout << (x[(n-1)/2] + x[n/2])/2 << " " << (y[(n-1)/2] + y[n/2])/2 << endl; } else{ cout << x[n/2] << " " << y[n/2] << endl; } } int32_t main(){ FIO; solve(); 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...