結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  horiesiniti | 
| 提出日時 | 2017-06-25 09:50:31 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 275 bytes | 
| コンパイル時間 | 439 ms | 
| コンパイル使用メモリ | 55,116 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-10-04 08:20:09 | 
| 合計ジャッジ時間 | 1,886 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 41 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&n);
      |         ~~~~~^~~~~~~~~
main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |                 scanf("%d",&d);
      |                 ~~~~~^~~~~~~~~
            
            ソースコード
#include <iostream>
using namespace std;
int xs[100003];
int main() {
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		int d;
		scanf("%d",&d);
		xs[d]=i;
	}
	for(int i=n;i>1;i--){
		if(xs[i]<xs[i-1]){
			printf("%d\n",i-1);
			return 0;
		}
	}
	printf("0\n");
	return 0;
}
            
            
            
        