結果

問題 No.267 トランプソート
ユーザー KKT89KKT89
提出日時 2020-10-14 21:18:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 693 bytes
コンパイル時間 2,535 ms
コンパイル使用メモリ 218,688 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-28 00:55:44
合計ジャッジ時間 3,552 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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]]<mp[j[1]];
    });
    for(int i=0;i<n;i++){
        cout << s[i] << " ";
    }
    cout << endl;
}
0