結果

問題 No.267 トランプソート
ユーザー kappybarkappybar
提出日時 2020-06-18 18:55:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,002 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 179,924 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-16 12:15:32
合計ジャッジ時間 2,870 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

map<char,int> mp = {{'A',1},{'2',2},{'3',3},{'4',4},{'5',5},{'6',6},{'7',7},{'8',8},{'9',9},{'T',10},{'J',11},{'Q',12},{'K',13}};
vector<char> inv = {'0','A','2','3','4','5','6','7','8','9','T','J','Q','K'};
vector<char> a = {'D','C','H','S'};

bool f(char l,char r){
    return mp[l] < mp[r];
}

int main(){
    int n;
    cin >> n;
    vector<vector<char>> ans(4,vector<char>());
    rep(i,n){
        string s;
        cin >> s;
        rep(i,4){
            if(s[0]==a[i]) ans[i].push_back(s[1]);
        }
    }

    rep(i,4) sort(ans[i].begin(),ans[i].end(),f);

    rep(i,4){
        rep(j,ans[i].size()) cout << a[i] << ans[i][j] << " ";
    }

    cout << endl;
    return 0;
}
0