結果
| 問題 |
No.5020 Averaging
|
| コンテスト | |
| ユーザー |
ldsyb
|
| 提出日時 | 2024-02-25 13:34:31 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 954 bytes |
| コンパイル時間 | 5,342 ms |
| コンパイル使用メモリ | 311,164 KB |
| 実行使用メモリ | 6,548 KB |
| スコア | 19,661,786 |
| 最終ジャッジ日時 | 2024-02-25 13:34:40 |
| 合計ジャッジ時間 | 8,088 ms |
|
ジャッジサーバーID (参考情報) |
judge10 / judge12 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
int main() {
int64_t n;
cin >> n;
vector<int64_t> as(n), bs(n);
for (int64_t i = 0; i < n; i++) {
cin >> as[i] >> bs[i];
}
int64_t c = 500000000000000000LL;
vector<int64_t> us, vs;
for (int64_t t = 0; t < 50; t++) {
for (int64_t i = 0; i < n; i++) {
for (int64_t j = i + 1; j < n; j++) {
if ((as[i] < c) != (as[j] < c) && (bs[i] < c) != (bs[j] < c)) {
int64_t x = (as[i] + as[j]) / 2;
int64_t y = (bs[i] + bs[j]) / 2;
as[i] = as[j] = x;
bs[i] = bs[j] = y;
us.push_back(i + 1);
vs.push_back(j + 1);
goto next;
}
}
}
next:;
}
cout << us.size() << endl;
for (int64_t i = 0; i < us.size(); i++) {
cout << us[i] << ' ' << vs[i] << endl;
}
return 0;
}
ldsyb