結果

問題 No.365 ジェンガソート
ユーザー newlife171128
提出日時 2018-01-18 08:12:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 81,728 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 11:01:30
合計ジャッジ時間 3,460 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <utility>

typedef long long ll;
using namespace std;

typedef pair<int, int> P;

ll genga[100001];
int main() {

	int n;
	cin >> n;

	int cp=0;

	int last =n;
	for (int i = 0; i < n; i++) {
		ll tmp = 0;
		cin >> tmp;

		genga[i] = tmp;
	}
	for(int j=n-1; j>=0; j--){
		if(genga[j] == last){
			cp++;
			last--;
		}
	}


	cout<<n-cp<<endl;

	return 0;
}
0