結果

問題 No.750 Frac #1
ユーザー kya_ski
提出日時 2020-03-30 22:58:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 508 bytes
コンパイル時間 1,501 ms
コンパイル使用メモリ 175,880 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 06:07:43
合計ジャッジ時間 2,498 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using data = pair<long double, pair<int, int>>;

int main() {
    int n;
    cin >> n;
    vector<data> v;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        long double val = (long double)a / b;
        v.emplace_back(val, make_pair(a, b));
    }
    
    sort(v.begin(), v.end(), greater<data>());
    for (const auto &e : v) {
        int a, b; tie(a, b) = e.second;
        cout << a << " " << b << '\n';
    }
    return 0;
}
0