結果

問題 No.365 ジェンガソート
ユーザー cwwcww
提出日時 2016-06-29 12:00:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 1,568 ms
コンパイル使用メモリ 167,932 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 02:28:11
合計ジャッジ時間 2,912 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define D(x) for_each((x).begin(),(x).end(),[](auto x){cout<<x<<" ";});
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int N;
	cin >> N;
	vector<int> vc(N);
	for( auto&& x : vc )
	{
		cin >> x;
	}
	reverse( vc.begin(), vc.end() );
	int cnt{1};
	for( const auto& x : vc )
	{
		if( N - cnt < x )
		{
			cnt++;
		}
	}
	cout << N - ( cnt - 1 ) << endl;
	return 0;
}
0