結果

問題 No.750 Frac #1
ユーザー nxteru
提出日時 2018-11-09 21:23:51
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 555 bytes
コンパイル時間 1,988 ms
コンパイル使用メモリ 169,980 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 05:29:32
合計ジャッジ時間 2,534 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 100000000000000000
int n;
struct f{
    int a,b;
    bool operator<(const f&q)const{
        if(a==0)return q.a>0;
        if(q.a==0)return a<0;
        return a*q.b<q.a*b;
    }
};
f x[15];
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i].a>>x[i].b;
    }
    sort(x,x+n);
    for(int i=n-1;i>=0;i--)cout<<x[i].a<<' '<<x[i].b<<endl;
}
0