結果
| 問題 |
No.3073 Fraction Median
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-03-21 22:29:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 779 ms / 2,500 ms |
| コード長 | 977 bytes |
| コンパイル時間 | 1,700 ms |
| コンパイル使用メモリ | 165,012 KB |
| 実行使用メモリ | 9,088 KB |
| 最終ジャッジ日時 | 2025-03-21 22:30:09 |
| 合計ジャッジ時間 | 13,699 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,s,n) for (int i = (s); i < (n); ++i)
#define rrep(i,n,g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define len(x) (int)(x).size()
#define dup(x,y) (((x)+(y)-1)/(y))
#define pb push_back
#define eb emplace_back
#define Field(T) vector<vector<T>>
#define pq(T) priority_queue<T, vector<T>, greater<T>>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
int main() {
int n;
cin >> n;
vector<int> a(n);
rep(i,0,n) cin >> a[i];
sort(all(a));
int x = a[0], y = a[1];
rep(i,2,n) {
if (1LL*x*a[i] <= 1LL*y*a[i-1]) {
x = a[i-1], y = a[i];
}
}
int g = __gcd(x, y);
x /= g, y /= g;
cout << x << " " << y << endl;
return 0;
}