結果

問題 No.571 3人兄弟(その2)
ユーザー CleyLCleyL
提出日時 2020-02-11 22:59:27
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 16:47:36
合計ジャッジ時間 1,659 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 3 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct dta{
    char name;
    int hgt,wgt;
};
bool comp(const dta&df,dta&ds){
    if(df.hgt == ds.hgt){
        return df.wgt < ds.wgt;
    }else{
        return df.hgt > ds.hgt;
    }
}
int main(){
    vector<dta> Z(3);
    for(int i = 0; 3 > i; i++){
        Z[i].name = 'A'+i;
        cin>>Z[i].hgt >> Z[i].wgt;
    }
    sort(Z.begin(),Z.end(),comp);
    for(int i = 0; 3 > i; i++){
        cout << Z[i].name << endl;
    }
}
0