結果
問題 | No.267 トランプソート |
ユーザー |
|
提出日時 | 2022-09-28 19:22:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 2,702 ms |
コンパイル使用メモリ | 212,088 KB |
最終ジャッジ日時 | 2025-02-07 18:02:41 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; vector<tuple<int,int,char,string>> A(N); rep(i,N) { char c; cin >> c; string s; cin >> s; int a = [c]() { if(c == 'D') return 0; if(c == 'C') return 1; if(c == 'H') return 2; if(c == 'S') return 3; return -1; }(); int b = [s]() { if(s == "A") return 1; if(s == "T") return 10; if(s == "J") return 11; if(s == "Q") return 12; if(s == "K") return 13; return stoi(s); }(); A[i] = {a, b, c, s}; } sort(A.begin(), A.end()); for(auto [_, __, m, n] : A) cout << m << n << " "; cout << endl; }