제출 #965926

#제출 시각아이디문제언어결과실행 시간메모리
965926detectivebowonBest Place (NOI17_bestplace)C++14
13 / 100
1055 ms6740 KiB
#include<bits/stdc++.h> #define int long long using namespace std; int n,x[100007],y[1000007],ans=LLONG_MAX,ansx,ansy; signed main() { cin>>n; for(int i=1;i<=n;i++) cin>>x[i]>>y[i]; int dist=0; for(int i=0;i<=100;i++) { for(int j=0;j<=100;j++) { int sum=0; for(int k=1;k<=n;k++) { sum+=abs(x[k]-i)+abs(y[k]-j); } if(sum<ans) { ans=sum; ansx=i; ansy=j; } } } cout<<ansx<<" "<<ansy; }

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

bestplace.cpp: In function 'int main()':
bestplace.cpp:10:9: warning: unused variable 'dist' [-Wunused-variable]
   10 |     int dist=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...