結果
問題 |
No.267 トランプソート
|
ユーザー |
|
提出日時 | 2020-06-01 03:57:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 823 bytes |
コンパイル時間 | 1,968 ms |
コンパイル使用メモリ | 182,864 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-20 16:13:47 |
合計ジャッジ時間 | 2,917 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++) #define ALL(x) (x).begin(), (x).end() const double PI = acos(-1); int mark(const string &s) { return string("DCHS").find(s[0]); } int digit(const string &s) { if ('0' <= s[1] && s[1] <= '9') return s[1] - '0'; if (s[1] == 'A') return 1; if (s[1] == 'T') return 10; if (s[1] == 'J') return 11; if (s[1] == 'Q') return 12; return 13; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); vector<tuple<int, int, string> > v; int n; cin >> n; REP (i, n) { string s; cin >> s; v.emplace_back(mark(s), digit(s), s); } sort(v.begin(), v.end()); REP (i, n) cout << get<2>(v[i]) << " "; cout << endl; return 0; }