結果

問題 No.267 トランプソート
ユーザー take000take000
提出日時 2020-04-19 20:16:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,187 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 176,920 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 22:59:43
合計ジャッジ時間 2,855 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
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>
#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] << "\n";
        }
    }

    return 0;
}
0