結果
問題 |
No.571 3人兄弟(その2)
|
ユーザー |
|
提出日時 | 2018-04-28 15:42:22 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 587 bytes |
コンパイル時間 | 945 ms |
コンパイル使用メモリ | 79,364 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 23:21:24 |
合計ジャッジ時間 | 1,562 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 |
ソースコード
#include<iostream> #include<algorithm> #include<vector> using namespace std; struct Boy{ string s; int height, weight; }; bool comp(const Boy& a, const Boy& b){ if(a.height != b.height){ return a.height > b.height; }else{ return a.weight < b.weight; } } int main(){ vector<Boy> boys(3); for(int i = 0; i < 3; i++){ boys[i].s = (char)('A'+ i); cin >> boys[i].height >> boys[i].weight; } sort(boys.begin(), boys.end(), comp); for(int i = 0; i < 3; i++){ cout << boys[i].s << endl; } return 0; }