結果
| 問題 | No.564 背の順 | 
| コンテスト | |
| ユーザー |  hanorver | 
| 提出日時 | 2017-09-09 15:12:56 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 3 ms / 2,000 ms | 
| コード長 | 649 bytes | 
| コンパイル時間 | 1,169 ms | 
| コンパイル使用メモリ | 97,892 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 09:34:03 | 
| 合計ジャッジ時間 | 1,807 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <iomanip>
int main()
{
	long long h, n;
	std::cin >> h >> n;
	std::vector<long long > v(n);
	v[0] = h;
	for (size_t i = 1; i < n; i++) {
		std::cin >> v[i];
	}
	std::sort(v.begin(), v.end());
	std::reverse(v.begin(), v.end());
	auto pos = std::find(v.begin(), v.end(), h) - v.begin() + 1;
	std::cout << pos << (pos % 10 == 1 ? "st" : (pos % 10 == 2 ? "nd" : (pos % 10 == 3 ? "rd" : "th"))) << std::endl;
	return 0;
}
            
            
            
        