結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
nahcnuj
|
| 提出日時 | 2016-04-29 23:29:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 390 bytes |
| コンパイル時間 | 709 ms |
| コンパイル使用メモリ | 60,720 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-04 19:05:11 |
| 合計ジャッジ時間 | 1,868 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 26 WA * 15 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N, max = 0, maxi;
vector<int> a;
cin >> N;
for (int i = 0, x; i < N; ++i) {
cin >> x;
a.push_back(x);
if (max < x) max = x, maxi = i;
}
int res = N - 1;
if (max == a[N-1]) {
for (int i = N-2; i >= 0; --i) {
if (a[i] == max - 1) --max, --res;
}
}
cout << res << endl;
return 0;
}
nahcnuj