結果
| 問題 |
No.5020 Averaging
|
| コンテスト | |
| ユーザー |
てんぷら
|
| 提出日時 | 2024-02-25 13:41:01 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 1,448 bytes |
| コンパイル時間 | 5,537 ms |
| コンパイル使用メモリ | 309,664 KB |
| 実行使用メモリ | 6,676 KB |
| スコア | 16,223,649 |
| 最終ジャッジ日時 | 2024-02-25 13:41:09 |
| 合計ジャッジ時間 | 7,856 ms |
|
ジャッジサーバーID (参考情報) |
judge10 / judge12 |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
const int inf = 1000000007;
const ll longinf = 1ll << 60;
double calculate_score(ll x) {
return 2000000 - 100000 * log10(abs(x - (ll)5e17) + 1);
}
void output(vector<pair<int, int>> &query) {
for(auto [l, r] : query) {
cout << l + 1 << " " << r + 1 << endl;
}
}
void do_query(vector<ll> &a, vector<ll> &b, int i, int j) {
ll x = (a[i] + a[j]) / 2;
ll y = (b[i] + b[j]) / 2;
a[i] = a[j] = x;
b[i] = b[j] = y;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector<ll> a(n), b(n);
rep(i, n) cin >> a[i] >> b[i];
vector<pair<int, int>> query;
rep(_, 50) {
double best = 0, idx = -1;
REP(j, 1, n) {
ll x = (a[0] + a[j]) / 2;
ll y = (b[0] + b[j]) / 2;
double ret = calculate_score(x) + calculate_score(y);
if(ret > best) {
best = ret;
idx = j;
}
}
query.push_back({0, idx});
do_query(a, b, 0, idx);
}
output(query);
cerr << 50 * min(calculate_score(a[0]), calculate_score(b[0])) << endl;
return 0;
}
てんぷら