結果
| 問題 |
No.3073 Fraction Median
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2025-03-21 21:50:13 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 323 ms / 2,500 ms |
| コード長 | 446 bytes |
| コンパイル時間 | 1,990 ms |
| コンパイル使用メモリ | 197,016 KB |
| 実行使用メモリ | 9,088 KB |
| 最終ジャッジ日時 | 2025-03-21 21:50:22 |
| 合計ジャッジ時間 | 8,925 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin >> N;
vector<int> A(N);
for (int i = 0; i < N; i++){
cin >> A[i];
}
sort(A.begin(), A.end());
long long x = A[0], y = A[1];
for (int i = 1; i < N - 1; i++){
if (A[i] * y >= A[i + 1] * x){
x = A[i];
y = A[i + 1];
}
}
int g = gcd(x, y);
cout << x / g << ' ' << y / g << endl;
}
SSRS