結果
| 問題 |
No.564 背の順
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-11 21:32:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 798 bytes |
| コンパイル時間 | 1,885 ms |
| コンパイル使用メモリ | 172,448 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-09 11:44:27 |
| 合計ジャッジ時間 | 2,266 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 3 WA * 6 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define rep(i, a, n) for (int i = a; i < n; ++i)
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int h, n;
cin >> h >> n;
vector<int> hi(n - 1);
rep(i, 0, n - 1) cin >> hi[i];
sort(hi.begin(), hi.end());
reverse(hi.begin(), hi.end());
if (hi[0] < h) {
cout << "1st" << endl;
return 0;
} else if (hi[1] < h) {
cout << "2nd" << endl;
return 0;
} else if (hi[2] < h) {
cout << "3rd" << endl;
return 0;
} else {
rep(i, 3, n - 1) {
if (hi[i] < h) {
cout << i << "th" << endl;
return 0;
}
}
}
cout << n << "th" << endl;
return 0;
}