結果

問題 No.750 Frac #1
ユーザー KKT89KKT89
提出日時 2019-10-23 22:36:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 451 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 79,136 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-07 05:38:17
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n; cin >> n;
	vector<int> a(n),b(n);
	vector<pair<double,int> > v;
	for(int i=0;i<n;i++){
		cin >> a[i] >> b[i];
		v.push_back(make_pair((double)a[i]/b[i],i));
	}
	sort(v.begin(),v.end());
	for(int i=n-1;i>=0;i--){
		cout << a[v[i].second] << " " << b[v[i].second] << endl;
	}
}
0