結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  rodea | 
| 提出日時 | 2017-12-22 17:53:53 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 341 bytes | 
| コンパイル時間 | 620 ms | 
| コンパイル使用メモリ | 65,092 KB | 
| 実行使用メモリ | 13,636 KB | 
| 最終ジャッジ日時 | 2024-12-17 23:14:41 | 
| 合計ジャッジ時間 | 18,222 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 36 TLE * 5 | 
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:20:17: warning: 'c' may be used uninitialized [-Wmaybe-uninitialized]
   20 |                 if (b > c)
      |                 ^~
main.cpp:6:36: note: 'c' was declared here
    6 |         int n, i, j, a[100000], b, c;
      |                                    ^
main.cpp:20:17: warning: 'b' may be used uninitialized [-Wmaybe-uninitialized]
   20 |                 if (b > c)
      |                 ^~
main.cpp:6:33: note: 'b' was declared here
    6 |         int n, i, j, a[100000], b, c;
      |                                 ^
            
            ソースコード
#include<iostream>
using namespace std;
int main()
{
	int n, i, j, a[100000], b, c;
	cin >> n;
	for (i = 1; i <= n; i++) cin >> a[i];
	for (i = n; i >= 2; i--)
	{
		for (j = 1; j <= n; j++)
		{
			if (a[j] == i - 1) b = j;
			if (a[j] == i) c = j;
		}
		if (b > c)
		{
			cout << i - 1 << endl;
			return 0;
		}
	}
	cout << 0 << endl;
}
            
            
            
        