제출 #966026

#제출 시각아이디문제언어결과실행 시간메모리
966026JungPSBest Place (NOI17_bestplace)C++14
3 / 100
16 ms1240 KiB
#include<iostream> #include<cmath> using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int n; cin >> n; int x[n],y[n]; for(int i=0;i<n;++i) cin >> x[i] >> y[i]; if(n==2){ cout << x[0] << " " << y[0]; return 0; } else{ int sum=0; for(int i=0;i<n;++i) sum+=x[i]; int mi=1e9,cur=0,cur2=0; cur=0; for(int i=0;i<n;++i) cur+=abs(x[i]-ceil(sum/n)); for(int i=0;i<n;++i) cur2+=abs(x[i]-floor(sum/n)); if(cur<cur2){ cout << ceil(sum/n) << " " << 0; return 0; } else{ cout << floor(sum/n) << " " << 0; return 0; } } }

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

bestplace.cpp: In function 'int main()':
bestplace.cpp:17:13: warning: unused variable 'mi' [-Wunused-variable]
   17 |         int mi=1e9,cur=0,cur2=0;
      |             ^~
#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...