結果

問題 No.750 Frac #1
コンテスト
ユーザー eyeSharp
提出日時 2019-10-16 22:15:27
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 617 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,013 ms
コンパイル使用メモリ 196,224 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-07 19:41:50
合計ジャッジ時間 2,748 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/*
    No.750 Frac #1
    https://yukicoder.me/problems/no/750
*/
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pair<double, string>> vsd(n);

    for (int i = 0; i < n; i++) {
        int left, right;
        cin >> left >> right;
        string s = to_string(left) + " " + to_string(right);
        vsd[i] = make_pair((double)left / right, s);
    }

    // sorted
    sort(vsd.begin(), vsd.end());

    for (int i = n - 1; i >= 0; i--) {
        // cout << vsd[i].first;
        cout << vsd[i].second << endl;
    }
}
0