結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2017-12-31 17:44:59 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 884 bytes |
コンパイル時間 | 957 ms |
コンパイル使用メモリ | 84,196 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 15:31:00 |
合計ジャッジ時間 | 1,482 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#include <iostream> #include <algorithm> #include <queue> #include <vector> #include <map> #include <string> using namespace std; void solve(); int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); } void solve() { int H,n; cin >> H >> n; int h[n]; for(int i = 0; i < n-1; i++) { cin >> h[i]; } vector<pair<int,int> > v; v.push_back(make_pair(H,0)); for(int i = 0; i < n-1; i++) { v.push_back(make_pair(h[i],1)); } sort(v.begin(), v.end()); for(int i = 0; i < n; i++) { if(v.at(i).second == 0) { int tmp = n - i; cout << tmp; if(tmp % 10 == 1) cout << "st"; else if(tmp % 10 == 2) cout << "nd"; else if(tmp % 10 == 3) cout << "rd"; else cout << "th"; cout << endl; break; } } }