제출 #785804

#제출 시각아이디문제언어결과실행 시간메모리
785804mekybrBest Place (NOI17_bestplace)C++14
100 / 100
66 ms2992 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n,ansx,ansy,len; cin>>n; int coordx[n]; int coordy[n]; for(int x=0;x<n;x++){ int xi,yi; cin>>xi>>yi; coordx[x]=xi; coordy[x]=yi; } len=sizeof(coordx)/sizeof(coordx[0]); sort(coordx,coordx+n); sort(coordy,coordy+n); for(int y=0;y<n;y++){ if(n%2==0){ //ansx=((coordx[(n/2)-1]+coordx[(n/2)])/2); //ansy=((coordy[(n/2)-1]+coordy[(n/2)])/2); ansx=0.5*(coordx[(n/2)-1]+coordx[(n/2)]); ansy=0.5*(coordy[(n/2)-1]+coordy[(n/2)]); } else{ ansx=coordx[((n+1)/2)-1]; ansy=coordy[((n+1)/2)-1]; } } cout<<ansx<<" "<<ansy; }

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

bestplace.cpp: In function 'int main()':
bestplace.cpp:4:21: warning: variable 'len' set but not used [-Wunused-but-set-variable]
    4 |     int n,ansx,ansy,len;
      |                     ^~~
bestplace.cpp:39:17: warning: 'ansx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   39 |     cout<<ansx<<" "<<ansy;
      |                 ^~~
bestplace.cpp:39:22: warning: 'ansy' may be used uninitialized in this function [-Wmaybe-uninitialized]
   39 |     cout<<ansx<<" "<<ansy;
      |                      ^~~~
#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...