結果
| 問題 |
No.267 トランプソート
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-22 12:09:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 890 bytes |
| コンパイル時間 | 3,252 ms |
| コンパイル使用メモリ | 206,952 KB |
| 最終ジャッジ日時 | 2025-01-09 09:32:40 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include<bits/stdc++.h>
using lint=long long;
int main(){
std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
lint n;std::cin>>n;
std::vector<std::pair<lint,std::string>>a(n);
std::vector<char>table0(13),table1{'D','C','H','S'};
std::iota(table0.begin(),table0.end(),'1');
table0.at(0)='A';
table0.at(9)='T';
table0.at(10)='J';
table0.at(11)='Q';
table0.at(12)='K';
for(lint i=0;i<n;i++){
std::string s;std::cin>>s;
a.at(i)={
13*(std::find(table1.begin(),table1.end(),s.at(0))-table1.begin())
+(std::find(table0.begin(),table0.end(),s.at(1))-table0.begin()),
s
};
}
std::sort(a.begin(),a.end());
for(lint i=0;i<n;i++){
std::cout<<(i?" ":"")<<a.at(i).second;
}
std::cout<<'\n';
}
ngtkana