結果

問題 No.267 トランプソート
ユーザー KKT89KKT89
提出日時 2020-10-14 21:17:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 2,745 ms
コンパイル使用メモリ 219,688 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-28 00:55:34
合計ジャッジ時間 4,045 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    map<char,int> mp;
    map<char,int> mpp;
    for(char c='2';c<='9';c++){
        mp[c]=c-'0';
    }
    mp['A']=1; mp['T']=10; mp['J']=11; mp['Q']=12; mp['K']=13;
    mpp['D']=0; mpp['C']=1; mpp['H']=2; mpp['S']=3;
    vector<string> s(n);
    for(int i=0;i<n;i++){
        cin >> s[i];
    }
    sort(s.begin(), s.end(),[&](auto i,auto j){
        if(mpp[i[0]]!=mpp[j[0]])return mpp[i[0]]<mpp[j[0]];
        else return mp[i[1]]<mpp[j[1]];
    });
    for(int i=0;i<n;i++){
        cout << s[i] << " ";
    }
    cout << endl;
}
0