結果
問題 |
No.267 トランプソート
|
ユーザー |
![]() |
提出日時 | 2025-03-15 00:49:15 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 974 bytes |
コンパイル時間 | 3,921 ms |
コンパイル使用メモリ | 287,160 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-15 00:49:20 |
合計ジャッジ時間 | 4,799 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline int suiteOrd(char c) { if (c == 'D') return 0; if (c == 'C') return 1; if (c == 'H') return 2; if (c == 'S') return 3; assert(false); } inline int numOrd(char c) { if (c == 'A') return 1; if (c == 'T') return 10; if (c == 'J') return 11; if (c == 'Q') return 12; if (c == 'K') return 13; return c - '0'; } int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector<string> v(n); rep(i, n) cin >> v[i]; sort(v.begin(), v.end(), [](string a, string b) { assert(a.size() == 2); assert(b.size() == 2); if (a[0] != b[0]) return suiteOrd(a[0]) < suiteOrd(b[0]); return numOrd(a[1]) < numOrd(b[1]); }); rep(i, n) cout << v[i] << " \n"[i == n - 1]; return 0; }