結果
| 問題 |
No.2315 Flying Camera
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-05-26 21:22:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 2,000 ms |
| コード長 | 612 bytes |
| コンパイル時間 | 1,425 ms |
| コンパイル使用メモリ | 171,912 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-25 04:27:41 |
| 合計ジャッジ時間 | 2,667 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n, x, y;
cin >> n;
vector<pair<int,int>> a(n);
for(int i = 0; i < n; i++){
cin >> x >> y;
a[i] = {x, y};
}
int ans = 1 << 30;
for(int cx = 0; cx <= 300; cx++){
for(int cy = 0; cy <= 300; cy++){
int s = 0;
for(int i = 0; i < n; i++){
tie(x, y) = a[i];
s += abs(x - cx) + abs(y - cy);
}
ans = min(ans, s);
}
}
cout << ans << '\n';
}