제출 #654777

#제출 시각아이디문제언어결과실행 시간메모리
6547770x9oBest Place (NOI17_bestplace)C++14
100 / 100
37 ms3028 KiB
#include <bits/stdc++.h> using namespace std; int query(int* K, int l) { int sum = K[0] + K[l-1]; // cout << K[0] << " " << K[l-1] << "\n"; // if (l%2 != 0) { // return K[(l/2)+1]; // } return K[l/2]; } void printarr(int* K, int l) { for (int i=0; i<l; i++) { std::cout << K[i] << " "; } std::cout << endl; } int sum_off_differences(int* X, int* Y, int l, int f) { int sum = 0; for (int i=0; i<l; i++) { int diff = abs(X[f]-X[i]) + abs(Y[f]-Y[i]); sum += diff; } return sum; } int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int N; std::cin >> N; int X[N], Y[N]; for (int i=0; i<N; i++) { std::cin >> X[i] >> Y[i]; } std::sort(X, X+N); std::sort(Y, Y+N); // printarr(X, N); // printarr(Y, N); // cout << sum_off_differences(X, Y, N, N/2) << endl; std::cout <<X[N/2] << " " << Y[N/2] << "\n"; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bestplace.cpp: In function 'int query(int*, int)':
bestplace.cpp:5:6: warning: unused variable 'sum' [-Wunused-variable]
    5 |  int sum = K[0] + K[l-1];
      |      ^~~
#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...