結果
| 問題 |
No.3073 Fraction Median
|
| コンテスト | |
| ユーザー |
遭難者
|
| 提出日時 | 2025-03-12 01:02:02 |
| 言語 | C++17(gnu拡張) (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 781 bytes |
| コンパイル時間 | 2,090 ms |
| コンパイル使用メモリ | 195,076 KB |
| 実行使用メモリ | 15,008 KB |
| 最終ジャッジ日時 | 2025-03-20 02:01:58 |
| 合計ジャッジ時間 | 6,753 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 14 |
ソースコード
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define SI(a) a.size()
#define vec vector
template <typename T> bool chmin(T &x, T y) {
if (y < x) {
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() {
int n;
cin >> n;
using ld = long double;
vec<long> c(n);
rep(i, n) cin >> c[i];
int idx = -1;
ld val = -1;
for (int i = 1; i < n; i++) {
ld val2 = c[i - 1];
val2 /= c[i];
if (val < val2) {
idx = i;
}
}
long c1 = c[idx - 1], c2 = c[idx];
long g = gcd(c1, c2);
cout << c1 / g << " " << c2 / g << endl;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
}
遭難者