Submission #987212

#TimeUsernameProblemLanguageResultExecution timeMemory
987212CornerBoiBest Place (NOI17_bestplace)C++14
53 / 100
1070 ms2276 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define all(x) x.begin(),x.end() int main() { int n;cin>>n; vector<int> a_x(n); vector<int> a_y(n); for(size_t i = 0;i<n;i++) { cin>>a_x[i]>>a_y[i]; } sort(all(a_x)); sort(all(a_y)); ll mini = LLONG_MAX; ll loc = 0; for(size_t i = 0;i<n;i++) { ll curr = 0; ll x = a_x[i]; ll y = a_y[i]; for(size_t j = 0;j<n;j++) { curr += abs(x-a_x[j]); curr += abs(y-a_y[j]); } if(mini < curr){break;} else {mini = min(mini,curr);loc = i;} } cout<<a_x[loc]<<" "<<a_y[loc]<<endl; return 0; }

Compilation message (stderr)

bestplace.cpp: In function 'int main()':
bestplace.cpp:14:23: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   14 |     for(size_t i = 0;i<n;i++)
      |                      ~^~
bestplace.cpp:25:23: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   25 |     for(size_t i = 0;i<n;i++)
      |                      ~^~
bestplace.cpp:32:27: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         for(size_t j = 0;j<n;j++)
      |                          ~^~
#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...