結果
| 問題 |
No.2353 Guardian Dogs in Spring
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-16 23:19:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,480 bytes |
| コンパイル時間 | 1,735 ms |
| コンパイル使用メモリ | 175,592 KB |
| 実行使用メモリ | 533,128 KB |
| 最終ジャッジ日時 | 2024-06-24 16:28:50 |
| 合計ジャッジ時間 | 5,507 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 MLE * 1 -- * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ld, ld> point;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = (int)(20) + 7;
const int M = (int)(1e3) + 7;
const ll MOD = (ll)(998244353);
const ll INF = (ll)(1e10) + 7;
const ld eps = (ld)(1e-12);
#define pb push_back
#define mp make_pair
#define x first
#define y second
void precalc() {
}
void solve(int num_t) {
int n;
cin >> n;
vector<pair<pii, int> > p(n);
vector<int> mark(n);
vector<pair<ll, pii> > d;
for (int i = 0; i < n; ++i) {
cin >> p[i].x.x >> p[i].x.y;
p[i].y = i;
}
sort(p.begin(), p.end());
for (int i = 0; i < n; ++i) {
for (int j = 0; j < i; ++j) {
d.pb(mp((ll)(p[i].x.x - p[j].x.x) * (ll)(p[i].x.x - p[j].x.x) +
(ll)(p[i].x.y - p[j].x.y) * (ll)(p[i].x.y - p[j].x.y), mp(i, j)));
}
}
sort(d.begin(), d.end());
vector<pii> ans;
for (int i = 0; i < (int)(d.size()); ++i) {
if (!mark[d[i].y.x] && !mark[d[i].y.y]) {
ans.pb(d[i].y);
mark[d[i].y.x] = 1;
mark[d[i].y.y] = 1;
}
}
cout << ans.size() << endl;
for (int i = 0; i < (int)(ans.size()); ++i) {
cout << ans[i].x + 1 << ' ' << ans[i].y + 1 << endl;
}
}
int main() {
precalc();
/*int ttt;
cin >> ttt;
for (int i = 0; i < ttt; ++i) {
solve(i);
}//*/solve(0);
return 0;
}