結果

問題 No.564 背の順
ユーザー tapioka324tapioka324
提出日時 2020-08-11 21:32:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 798 bytes
コンパイル時間 2,357 ms
コンパイル使用メモリ 167,808 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 17:37:42
合計ジャッジ時間 2,520 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0