結果

問題 No.750 Frac #1
ユーザー hiragn
提出日時 2019-07-27 21:01:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 466 bytes
コンパイル時間 1,643 ms
コンパイル使用メモリ 173,040 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 11:15:13
合計ジャッジ時間 2,854 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

bool cmp(pair<int, int> a, pair<int, int> b) {
    return a.first * b.second > b.first * a.second;
}

int main() {
    int n;
    cin >> n;

    vector<pair<int, int>> vt;
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        vt.emplace_back(a, b);
    }

    sort(vt.begin(), vt.end(), cmp);
    for (auto x:vt) {
        cout << x.first << " " << x.second << endl;
    }
    return 0;
}
0