結果
問題 |
No.564 背の順
|
ユーザー |
![]() |
提出日時 | 2017-09-08 22:28:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 692 bytes |
コンパイル時間 | 1,369 ms |
コンパイル使用メモリ | 162,908 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 05:26:13 |
合計ジャッジ時間 | 1,953 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for (int (i)=(0);(i)<(int)(n);++(i)) using ll = long long; using P = pair< int, int >; int main() { int h, n; cin >> h >> n; vector<int> a; int N = n-1; rep(i, N) { int t; cin >> t; if (t != h) { a.push_back(t); } else { n--; } } a.push_back(h); sort(a.begin(), a.end()); int rank = n - (lower_bound(a.begin(), a.end(), h) - a.begin()); cout << rank; if (rank == 1) cout << "st" << endl; else if (rank == 2) cout << "nd" << endl; else if (rank == 3) cout << "rd" << endl; else cout << "th" << endl; return 0; }