結果

問題 No.564 背の順
ユーザー jellyfish_26jellyfish_26
提出日時 2017-09-12 15:44:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 1,345 ms
コンパイル使用メモリ 162,140 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 07:06:04
合計ジャッジ時間 1,900 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  int H,N;
  std::cin >> H >> N;
  std::priority_queue <int> high;
  high.push(H);
  int Ha;
  for(int a = 2; a <= N; ++a) {
    std::cin >> Ha;
    high.push(Ha);
  }
  int ans = 0;
  while(!high.empty()) {
    if(high.top() == H) {
      ++ans;
      break;
    }else{
      ++ans;
    }
    high.pop();
  }
  if(ans == 1) std::cout << "1st" << std::endl;
  if(ans == 2) std::cout << "2nd" << std::endl;
  if(ans == 3) std::cout << "3rd" << std::endl;
  if(ans >= 4) std::cout << ans << "th" << std::endl;
}
0