Submission #464780

# Submission time Handle Problem Language Result Execution time Memory
464780 2021-08-14T05:57:21 Z avaneeshk098 Best Place (NOI17_bestplace) C++17
100 / 100
43 ms 3812 KB
#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 time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 2972 KB Output is correct
2 Correct 30 ms 3020 KB Output is correct
3 Correct 30 ms 3032 KB Output is correct
4 Correct 24 ms 3024 KB Output is correct
5 Correct 28 ms 3060 KB Output is correct
6 Correct 30 ms 3024 KB Output is correct
7 Correct 30 ms 2996 KB Output is correct
8 Correct 30 ms 3148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 41 ms 3780 KB Output is correct
2 Correct 43 ms 3796 KB Output is correct
3 Correct 31 ms 3788 KB Output is correct
4 Correct 38 ms 3032 KB Output is correct
5 Correct 41 ms 3788 KB Output is correct
6 Correct 41 ms 3804 KB Output is correct
7 Correct 41 ms 3812 KB Output is correct
8 Correct 42 ms 3788 KB Output is correct