結果

問題 No.267 トランプソート
ユーザー take000take000
提出日時 2020-04-19 20:17:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,204 bytes
コンパイル時間 2,214 ms
コンパイル使用メモリ 177,536 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 23:00:34
合計ジャッジ時間 2,922 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
const int INF = 1e9;

int main() {
    int n;
    cin >> n;

    vector<vector<string>> s(4);
    string t = "DCHS";
    rep(i, n) {
        string S;
        cin >> S;

        if (S[1] == 'A')
            S[1] = '1';
        else if (S[1] == 'T')
            S[1] = 'A';
        else if (S[1] == 'J')
            S[1] = 'B';
        else if (S[1] == 'Q')
            S[1] = 'C';
        else if (S[1] == 'K')
            S[1] = 'D';

        rep(i, 4) {
            if (t[i] == S[0])
                s[i].push_back(S);
        }
    }

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

    rep(i, 4) {
        rep(j, s[i].size()) {
            if (s[i][j][1] == '1')
                s[i][j][1] = 'A';
            else if (s[i][j][1] == 'A')
                s[i][j][1] = 'T';
            else if (s[i][j][1] == 'B')
                s[i][j][1] = 'J';
            else if (s[i][j][1] == 'C')
                s[i][j][1] = 'Q';
            else if (s[i][j][1] == 'D')
                s[i][j][1] = 'K';
            cout << s[i][j] << " ";
        }
    }
    cout << "\n";

    return 0;
}
0