結果
問題 | No.2315 Flying Camera |
ユーザー |
|
提出日時 | 2024-03-18 21:53:13 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 526 bytes |
コンパイル時間 | 3,798 ms |
コンパイル使用メモリ | 263,372 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-30 05:02:41 |
合計ジャッジ時間 | 5,158 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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;}