結果
| 問題 |
No.3073 Fraction Median
|
| コンテスト | |
| ユーザー |
hiromi_ayase
|
| 提出日時 | 2025-03-21 23:08:03 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 346 ms / 2,500 ms |
| コード長 | 820 bytes |
| コンパイル時間 | 6,232 ms |
| コンパイル使用メモリ | 332,360 KB |
| 実行使用メモリ | 15,048 KB |
| 最終ジャッジ日時 | 2025-03-21 23:08:16 |
| 合計ジャッジ時間 | 13,302 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define FAST_IO \
ios::sync_with_stdio(false); \
cin.tie(0);
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
int main() {
FAST_IO
auto ans = 0LL;
int N;
cin >> N;
vector<i64> A(N);
for (auto& x : A) cin >> x;
ranges::sort(A);
int maxArg = 0;
for (int i = 0; i < N - 1; i ++) {
i64 x = A[i];
i64 y = A[i+1];
i64 mx = A[maxArg];
i64 my = A[maxArg+1];
// x/y > mx/my
if (x * my > y * mx) {
maxArg = i;
}
}
auto d = gcd(A[maxArg], A[maxArg+1]);
auto x = A[maxArg] / d;
auto y = A[maxArg+1] / d;
cout << x << " " << y << endl;
}
hiromi_ayase