結果

問題 No.2315 Flying Camera
ユーザー 👑 CleyL
提出日時 2023-05-30 10:17:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 71,940 KB
最終ジャッジ日時 2025-02-13 16:29:28
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main(){
  int n;cin>>n;
  vector<pair<int,int>> A(n);
  for(int i = 0; n > i; i++)cin>>A[i].first>>A[i].second;
  int ans = 180000;
  for(int i = 1; 300 >= i; i++){
    for(int j = 1; 300 >= j; j++){
      int tmp_sum = 0;
      for(int k = 0; n > k; k++){
        tmp_sum += abs(i-A[k].first)+abs(j-A[k].second);
      }
      ans = min(ans,tmp_sum);
    }
  }
  cout << ans << endl;
}
0