結果
問題 | No.2315 Flying Camera |
ユーザー |
|
提出日時 | 2024-03-18 21:53:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 4,320 ms |
コンパイル使用メモリ | 252,068 KB |
最終ジャッジ日時 | 2025-02-20 07:20:00 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll = long long; int main() { int N; cin >> N; vector<pair<int, int>> xy(N); for (int i = 0; i < N; i++) cin >> xy[i].first >> xy[i].second; ll ans = 1e18; for (int x = 1; x <= 300; x++) { for (int y = 1; y <= 300; y++) { ll S = 0; for (int i = 0; i < N; i++) { S += abs(x - xy[i].first) + abs(y - xy[i].second); } ans = min(ans, S); } } cout << ans << endl; return 0; }