結果

問題 No.750 Frac #1
ユーザー ei1333333
提出日時 2018-11-09 21:21:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 381 bytes
コンパイル時間 1,793 ms
コンパイル使用メモリ 201,404 KB
最終ジャッジ日時 2025-01-06 15:56:05
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;


int main() {
  int N;
  vector< pair< int, int > > s;
  cin >> N;
  for(int i = 0; i < N; i++) {
    int x, y;
    cin >> x >> y;
    s.emplace_back(x, y);
  }
  sort(begin(s), end(s), [&](auto p, auto q) {
    return p.first * q.second > p.second * q.first;
  });

  for(auto &p : s) cout << p.first << " " << p.second << endl;

}
0