Submission #681858

#TimeUsernameProblemLanguageResultExecution timeMemory
681858dsyzBest Place (NOI17_bestplace)C++17
100 / 100
48 ms3800 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios_base::sync_with_stdio(false);cin.tie(0); ll N; cin>>N; ll arr[N]; ll arr2[N]; for(ll i = 0;i < N;i++){ ll a,b; cin>>a>>b; arr[i] = a; arr2[i] = b; // arr[i].second.first = a; // arr[i].second.second = b; // arr[i].first = a + b; } sort(arr,arr + N); sort(arr2,arr2 + N); if(N % 2 == 0){ ll sum1 = (arr[(N / 2) - 1] + arr[(N / 2)]) / 2; ll sum2 = (arr2[(N / 2) - 1] + arr2[(N / 2)]) / 2; //ll sum1 = (arr[(N / 2) - 1].second.first + arr[(N / 2)].second.first) / 2; //ll sum2 = (arr[(N / 2) - 1].second.second + arr[(N / 2)].second.second) / 2; cout<<sum1<<" "<<sum2<<'\n'; }else if(N % 2 == 1){ //cout<<N / 2<<'\n'; ll sum1 = arr[N / 2]; ll sum2 = arr2[N / 2]; cout<<sum1<<" "<<sum2<<'\n'; } }
#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...