結果
問題 | No.5020 Averaging |
ユーザー |
|
提出日時 | 2024-02-25 14:26:59 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,378 bytes |
コンパイル時間 | 1,102 ms |
コンパイル使用メモリ | 105,296 KB |
実行使用メモリ | 6,548 KB |
スコア | 13,798,757 |
最終ジャッジ日時 | 2024-02-25 14:27:03 |
合計ジャッジ時間 | 3,045 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
#include <iostream>#include <vector>#include <random>static std::mt19937 mt(0);using Entry = std::pair<int, int>;using Solution = std::vector<Entry>;auto gen_random_ans(int n) {constexpr int m = 50;std::vector<Entry> ans;for (int i = 0; i < m; i++) {int u, v;while (true) {u = mt() % n;v = mt() % n;if (u != v) {break;}}ans.emplace_back(u,v);}return ans;}long calc_score(const Solution& ans, const std::vector<long>& a, const std::vector<long>& b) {std::vector<long> aa = a;std::vector<long> bb = b;for (auto [u,v] : ans) {long v1 = (aa[u] + aa[v])/2;long v2 = (bb[u] + bb[v])/2;aa[u] = v1;aa[v] = v1;bb[u] = v2;bb[v] = v2;}double v1 = aa[0] - 5*1e17;double v2 = bb[0] - 5*1e17;long score = 2000000L - 100000L * std::log10(std::max(v1, v2) + 1);return score;}void print_ans(const Solution& ans) {std::cout << ans.size() << std::endl;for (auto [u,v] : ans) {std::cout << u+1 << " " << v+1 << std::endl;}}int main() {int n;std::cin >> n;std::vector<long> a(n), b(n);for (int i = 0; i < n; i++) {std::cin >> a[i] >> b[i];}auto ans = gen_random_ans(n);print_ans(ans);}