結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  kongarishisyamo | 
| 提出日時 | 2016-04-29 22:40:04 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 447 bytes | 
| コンパイル時間 | 623 ms | 
| コンパイル使用メモリ | 60,232 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-04 18:20:11 | 
| 合計ジャッジ時間 | 2,008 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 40 WA * 1 | 
ソースコード
#include<iostream>
#include<algorithm>
using namespace std;
int b[200005];
int bs[10000];
#define GETA 100000
int main(){
	int N;
	cin>>N;
	for(int i=0;i<N;i++) cin>>b[i+GETA],bs[i]=b[i+GETA];
	sort(bs,bs+N);
	int i=N-1;
	int j=N-1;
	int c=0;
	while(1){
		//cout<<i<<","<<j<<","<<bs[i]<<","<<b[j+GETA]<<endl;
		if(bs[i]!=b[j+GETA]){
			b[GETA-1-c]=bs[i];
			j--;
			c++;
		}
		else i--,j--;
		if(i==-1||j==-1) break;
	}
	cout<<c<<endl;
}
            
            
            
        