結果

問題 No.2353 Guardian Dogs in Spring
ユーザー shobonvipshobonvip
提出日時 2023-06-16 21:57:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 767 bytes
コンパイル時間 4,289 ms
コンパイル使用メモリ 264,744 KB
実行使用メモリ 398,624 KB
最終ジャッジ日時 2023-09-06 19:42:13
合計ジャッジ時間 22,769 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 605 ms
396,472 KB
testcase_06 AC 483 ms
396,448 KB
testcase_07 AC 476 ms
396,616 KB
testcase_08 AC 480 ms
396,516 KB
testcase_09 AC 545 ms
396,576 KB
testcase_10 AC 458 ms
396,524 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 452 ms
396,456 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 18 ms
15,504 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 16 ms
15,684 KB
testcase_25 AC 14 ms
15,752 KB
testcase_26 AC 11 ms
9,812 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 28 ms
29,296 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 451 ms
396,568 KB
testcase_34 AC 442 ms
396,480 KB
testcase_35 AC 447 ms
396,568 KB
testcase_36 AC 26 ms
27,984 KB
testcase_37 AC 12 ms
9,908 KB
testcase_38 AC 56 ms
52,532 KB
testcase_39 AC 80 ms
102,824 KB
testcase_40 AC 178 ms
199,852 KB
testcase_41 AC 204 ms
199,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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);
}
0