結果

問題 No.564 背の順
ユーザー kosakkunkosakkun
提出日時 2017-09-08 22:27:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,093 bytes
コンパイル時間 1,369 ms
コンパイル使用メモリ 117,480 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 20:31:27
合計ジャッジ時間 1,948 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
typedef long long ll;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())

string to_ans(int i) {
    if (i == 1) return "1st";
    if (i == 2) return "2nd";
    if (i == 3) return "3rd";
    return to_string(i) + "th";
}

int main() {

    int Hh,N; cin >> Hh >> N;
    vector<int> H(N - 1);
    REP(i,N - 1) cin >> H[i];

    sort(H.begin(),H.end());
    reverse(H.begin(), H.end());

    REP(i,H.size()) {
        if (H[i] < Hh) {
            cout << to_ans(i + 1) << endl;
            return 0;
        }
    }

    cout << to_ans(N) << endl;

    return 0;
}
0