結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  newlife171128 | 
| 提出日時 | 2018-01-18 08:13:57 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 11 ms / 2,000 ms | 
| コード長 | 646 bytes | 
| コンパイル時間 | 689 ms | 
| コンパイル使用メモリ | 81,580 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-24 11:01:48 | 
| 合計ジャッジ時間 | 2,073 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
ソースコード
#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;
    ios::sync_with_stdio(0);
    cin.tie(0);
	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;
}
            
            
            
        