結果
問題 |
No.2353 Guardian Dogs in Spring
|
ユーザー |
![]() |
提出日時 | 2023-06-16 21:57:56 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 767 bytes |
コンパイル時間 | 4,474 ms |
コンパイル使用メモリ | 257,008 KB |
最終ジャッジ日時 | 2025-02-14 05:38:05 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 WA * 14 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; typedef modint998244353 mint; typedef long long ll; int main(){ int n; cin >> n; vector<int> x(n), y(n); for (int i=0; i<n; i++){ cin >> x[i] >> y[i]; } cout << n/2 << endl; vector<tuple<int,int,int>> pq; for (int i=0; i<n; i++){ for (int j=i+1; j<n; j++){ int dist = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]); pq.push_back(tuple(dist, i, j)); } } vector<bool> seen(n); int cnt = 0; for (int piv=0; piv<(int)pq.size(); piv++){ auto [r, i, j] = pq[piv]; if (seen[i] || seen[j]) continue; cout << i+1 << " " << j+1 << endl; seen[i] = true; seen[j] = true; cnt++; if (cnt == n / 2) break; } assert(cnt == n / 2); }