結果

問題 No.2353 Guardian Dogs in Spring
ユーザー ortogawa
提出日時 2025-08-11 13:43:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 203,168 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-11 13:43:26
合計ジャッジ時間 7,348 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int ll
#define fast_io cin.tie(0)->sync_with_stdio(0);
#define endl '\n'
typedef long long ll;

int32_t main() {
	fast_io;

	int n; cin >> n;
	vector<pair<int, int>> a(n);
	for (auto &[x, y] : a) cin >> x >> y;

	vector<int> ord(n);
	iota(ord.begin(), ord.end(), 0);
	sort(ord.begin(), ord.end(), [&] (int i, int j) { return a[i] < a[j]; });

	cout << n/2 << endl;
	for (int i = 0; i + 1 < n; i += 2) {
		cout << ord[i]+1 << " " << ord[i+1]+1 << endl;
	}
}
0