結果

問題 No.365 ジェンガソート
ユーザー square1001
提出日時 2016-10-31 12:25:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 1,362 ms
コンパイル使用メモリ 165,716 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 00:01:47
合計ジャッジ時間 2,686 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int n, a[100009];
int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);
	int res = n;
	for(int i = n - 1; i >= 0; i--) {
		if(a[i] == res) res--;
	}
	printf("%d\n", res);
	return 0;
}
0