結果
問題 | No.2353 Guardian Dogs in Spring |
ユーザー |
![]() |
提出日時 | 2024-04-16 12:21:35 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 574 bytes |
コンパイル時間 | 2,137 ms |
コンパイル使用メモリ | 200,524 KB |
最終ジャッジ日時 | 2025-02-21 02:29:37 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h>using namespace std;void fast_io() {ios_base::sync_with_stdio(false);cin.tie(nullptr);}int main() {fast_io();int n;cin >> n;vector<pair<int, int>> xy(n);for (int i = 0; i < n; i++) {cin >> xy[i].first >> xy[i].second;}vector<int> idx(n);iota(idx.begin(), idx.end(), 0);sort(idx.begin(), idx.end(), [&](int i, int j) { return xy[i] < xy[j]; });cout << n / 2 << "\n";for (int i = 0; i < n - 1; i += 2) {cout << idx[i] + 1 << " " << idx[i + 1] + 1 << "\n";}}