結果
問題 | No.2353 Guardian Dogs in Spring |
ユーザー |
|
提出日時 | 2023-06-17 01:51:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 617 bytes |
コンパイル時間 | 2,761 ms |
コンパイル使用メモリ | 253,468 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-24 19:35:28 |
合計ジャッジ時間 | 7,674 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } vector<int> idx(n); iota(idx.begin(), idx.end(), 0); sort(idx.begin(), idx.end(), [&] (int i, int j) { return a[i] < a[j]; }); cout << n / 2 << '\n'; for (int i = 0; i < n / 2; i++) { cout << idx[2 * i] + 1 << ' ' << idx[2 * i + 1] + 1 << '\n'; } }