結果
問題 | No.5020 Averaging |
ユーザー | 遭難者 |
提出日時 | 2024-02-25 16:14:03 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,333 bytes |
コンパイル時間 | 10,190 ms |
コンパイル使用メモリ | 344,344 KB |
実行使用メモリ | 6,676 KB |
スコア | 0 |
最終ジャッジ日時 | 2024-02-25 16:15:04 |
合計ジャッジ時間 | 55,035 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
ソースコード
#pragma GCC target("avx2") #pragma GCC optimize("Ofast,unroll-loops") #include <bits/stdc++.h> #include <atcoder/all> #define rep(i, n) for (int i = 0; i < n; i++) #define per(i, n) for (int i = n - 1; i >= 0; i--) #define ALL(a) a.begin(), a.end() typedef long double ldouble; #undef long #define long long long #define vec vector using namespace std; using mint = atcoder::modint; ostream &operator<<(ostream &os, mint a) { return os << a.val(); } template <typename T> ostream &operator<<(ostream &os, vector<T> &a) { const int n = a.size(); rep(i, n) { os << a[i]; if (i + 1 != n) os << " "; } return os; } template <typename T, size_t n> ostream &operator<<(ostream &os, array<T, n> &a) { rep(i, n) os << a[i] << " \n"[i + 1 == n]; return os; } template <typename T> istream &operator>>(istream &is, vector<T> &a) { for (T &i : a) is >> i; return is; } template <typename T> bool chmin(T &x, T y) { if (x > y) { x = y; return true; } return false; } template <typename T> bool chmax(T &x, T y) { if (x < y) { x = y; return true; } return false; } void solve() { const auto start = chrono::system_clock::now(); constexpr int n = 45; int muda; cin >> muda; assert(muda == n); array<long, n> a, b; rep(i, n) cin >> a[i] >> b[i]; array<long, n> aa, bb; constexpr int m = 50; array<int, m> ansu, ansv; constexpr long inf = 5e17; long ans = 7e18; array<int, m> u, v; while (true) { const auto now_time = chrono::system_clock::now(); const auto elapsed_time = chrono::duration_cast<chrono::milliseconds>(now_time - start).count(); if (elapsed_time > 900) break; rep(i, m) u[i] = rand() % n; rep(i, m) v[i] = rand() % n; rep(i, n) { aa[i] = a[i]; bb[i] = b[i]; } rep(i, m) { aa[u[i]] = aa[v[i]] = (aa[u[i]] + aa[v[i]]) / 2; bb[u[i]] = bb[v[i]] = (bb[u[i]] + bb[v[i]]) / 2; } if (chmin(ans, max(abs(aa[0] - inf), abs(bb[0] - inf)))) { rep(i, m) ansu[i] = u[i]; rep(i, m) ansv[i] = v[i]; } } int x = m; rep(i, m) if (ansu[i] == ansv[i]) x--; cout << x << '\n'; rep(i, m) if (ansu[i] != ansv[i]) cout << ansu[i] << " " << ansv[i] << '\n'; } int main() { srand((unsigned)time(NULL)); cin.tie(nullptr); ios::sync_with_stdio(false); // cout << fixed << setprecision(400); int t = 1; // cin >> t; while (t--) solve(); return 0; }