제출 #481511

#제출 시각아이디문제언어결과실행 시간메모리
481511Swarnava_ChattarajBest Place (NOI17_bestplace)C++17
100 / 100
97 ms3012 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int void solve() { int n; cin >> n; int maxi_x = 0, maxi_y = 0; int mini_x = INT_MAX, mini_y = INT_MAX; vector<int> X(n); vector<int> Y(n); for(int i = 0; i < n; i++) { cin >> X[i] >> Y[i]; } sort(X.begin(), X.end()); sort(Y.begin(), Y.end()); int m_x = 0, m_y = 0; if(n % 2 != 0) m_x= X[n / 2]; else m_x = (X[(n - 1) / 2] + X[(n + 1) / 2]) / 2; if(n % 2 != 0) m_y= Y[n / 2]; else m_y = (Y[(n - 1) / 2] + Y[(n + 1) / 2]) / 2; cout << m_x << ' ' << m_y << endl; } int main(){ // #ifndef ONLINE_JUDGE // freopen("input.txt","r",stdin); // freopen("output.txt","w",stdout); // #endif // // ll T; // // cin >> T; // // while(T--) // // { // // solve(); // // } solve(); return 0; }

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

bestplace.cpp: In function 'void solve()':
bestplace.cpp:10:7: warning: unused variable 'maxi_x' [-Wunused-variable]
   10 |   int maxi_x = 0, maxi_y = 0;
      |       ^~~~~~
bestplace.cpp:10:19: warning: unused variable 'maxi_y' [-Wunused-variable]
   10 |   int maxi_x = 0, maxi_y = 0;
      |                   ^~~~~~
bestplace.cpp:11:7: warning: unused variable 'mini_x' [-Wunused-variable]
   11 |   int mini_x = INT_MAX, mini_y = INT_MAX;
      |       ^~~~~~
bestplace.cpp:11:25: warning: unused variable 'mini_y' [-Wunused-variable]
   11 |   int mini_x = INT_MAX, mini_y = INT_MAX;
      |                         ^~~~~~
#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...