結果

問題 No.365 ジェンガソート
ユーザー ant2357
提出日時 2016-04-30 21:50:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 981 ms
コンパイル使用メモリ 84,828 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 01:57:38
合計ジャッジ時間 2,565 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <deque>
#include <algorithm>

using namespace std;

int main() {
	int n;
	vector<int>a;
	cin >> n;

	a.push_back(0);
	for (int i = 0; i < n; i++) {
		int value;
		cin >> value;
		a.push_back(value);
	}

	int ans = n;
	for (int i = n; i != 0; i--) {
		if (a[i] == ans) {
			ans--;
		}
	}
	cout << ans << endl;
	return 0;
}
0