結果

問題 No.267 トランプソート
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-04-03 17:08:04
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,295 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 105,152 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-08 15:28:56
合計ジャッジ時間 2,656 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 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,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 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 <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    map<string,string> X;
    X["A"] = "1";
    X["T"] = "10";
    X["J"] = "11";
    X["Q"] = "12";
    X["K"] = "13";
    X["1"] = "A";
    X["10"] = "T";
    X["11"] = "J";
    X["12"] = "Q";
    X["13"] = "K";

    int N;
    cin >> N;
    vector< vector<string> > V(4);
    string S = "DCHS";
    for ( int i = 0; i < N; i++ ) {
        string s;
        cin >> s;        
        for ( int j = 0; j < 4; j++ ) {
            if ( S[j] == s[0] ) {
                s = s.substr(1,s.length()-1);
                if ( X[s].length() ) { s = X[s]; }
                V[j].push_back(s);
            }
        }
    }
    for ( int i = 0; i < 4; i++ ) {
        sort( V[i].begin(), V[i].end() );
        for ( int j = 0; j < V[i].size(); j++ ) {
            string s = V[i][j];
            if ( X[s].length() ) { s = X[s]; }
            cout << S[i] << s;            
            if ( i != 3 || j != V[i].size()-1 ) { cout << " "; }
        }        
    }
    cout << endl;

    return 0;
}
0