結果

問題 No.365 ジェンガソート
ユーザー rodearodea
提出日時 2017-12-22 17:53:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 341 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 63,512 KB
実行使用メモリ 8,264 KB
最終ジャッジ日時 2023-08-22 21:20:30
合計ジャッジ時間 7,658 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 66 ms
4,380 KB
testcase_17 TLE -
testcase_18 AC 28 ms
4,384 KB
testcase_19 TLE -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:20:17: 警告: ‘c’ may be used uninitialized [-Wmaybe-uninitialized]
   20 |                 if (b > c)
      |                 ^~
main.cpp:6:36: 備考: ‘c’ はここで定義されています
    6 |         int n, i, j, a[100000], b, c;
      |                                    ^
main.cpp:20:17: 警告: ‘b’ may be used uninitialized [-Wmaybe-uninitialized]
   20 |                 if (b > c)
      |                 ^~
main.cpp:6:33: 備考: ‘b’ はここで定義されています
    6 |         int n, i, j, a[100000], b, c;
      |                                 ^

ソースコード

diff #

#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;
}
0