結果
| 問題 | 
                            No.564 背の順
                             | 
                    
| コンテスト | |
| ユーザー | 
                             dsytk7
                         | 
                    
| 提出日時 | 2017-09-08 22:42:54 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 603 bytes | 
| コンパイル時間 | 1,552 ms | 
| コンパイル使用メモリ | 162,172 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 05:35:25 | 
| 合計ジャッジ時間 | 2,040 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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(n);
    rep(i, n-1) {
        cin >> a[i];
    }
    a[n-1] = h;
    sort(a.begin(), a.end());
    int rank = n - distance(a.begin(), lower_bound(a.begin(), a.end(), h));
    if (rank == 1) cout << rank << "st" << endl;
    else if (rank == 2) cout << rank << "nd" << endl;
    else if (rank == 3) cout << rank << "rd" << endl;
    else cout << rank << "th" << endl;
    return 0;
}
            
            
            
        
            
dsytk7