Submission #516353

#TimeUsernameProblemLanguageResultExecution timeMemory
516353JomnoiBest Place (NOI17_bestplace)C++17
100 / 100
42 ms3268 KiB
#include <bits/stdc++.h>
#define DEBUG 0
using namespace std;

int main() {
    int n;
    scanf(" %d", &n);
    vector <int> X, Y;
    for(int i = 1; i <= n; i++) {
        int x, y;
        scanf(" %d %d", &x, &y);
        X.push_back(x);
        Y.push_back(y);
    }
    sort(X.begin(), X.end());
    sort(Y.begin(), Y.end());
    if(n % 2 == 0) {
        X[n / 2] = (X[n / 2 - 1] + X[n / 2]) / 2;
        Y[n / 2] = (Y[n / 2 - 1] + Y[n / 2]) / 2;
    }

    printf("%d %d", X[n / 2], Y[n / 2]);
    return 0;
}

Compilation message (stderr)

bestplace.cpp: In function 'int main()':
bestplace.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf(" %d", &n);
      |     ~~~~~^~~~~~~~~~~
bestplace.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf(" %d %d", &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
#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...