結果

問題 No.750 Frac #1
コンテスト
ユーザー eyeSharp
提出日時 2019-10-16 22:15:27
言語 C++11
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 509µs
コード長 617 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,401 ms
コンパイル使用メモリ 191,920 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-27 15:33:06
合計ジャッジ時間 3,354 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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