結果

問題 No.411 昇順昇順ソート
ユーザー hogekihogeki
提出日時 2016-08-13 11:22:54
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 1,054 ms
コンパイル使用メモリ 105,344 KB
実行使用メモリ 23,296 KB
最終ジャッジ日時 2024-04-25 06:01:22
合計ジャッジ時間 6,188 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
23,296 KB
testcase_01 AC 26 ms
17,792 KB
testcase_02 AC 26 ms
17,920 KB
testcase_03 AC 26 ms
17,792 KB
testcase_04 AC 26 ms
17,664 KB
testcase_05 AC 26 ms
17,920 KB
testcase_06 AC 25 ms
17,920 KB
testcase_07 AC 26 ms
17,920 KB
testcase_08 AC 27 ms
17,920 KB
testcase_09 AC 26 ms
17,920 KB
testcase_10 AC 26 ms
17,664 KB
testcase_11 AC 26 ms
17,920 KB
testcase_12 AC 27 ms
17,920 KB
testcase_13 AC 26 ms
17,920 KB
testcase_14 AC 26 ms
17,920 KB
testcase_15 AC 26 ms
17,792 KB
testcase_16 AC 26 ms
17,792 KB
testcase_17 AC 27 ms
17,792 KB
testcase_18 AC 27 ms
17,792 KB
testcase_19 AC 26 ms
17,920 KB
testcase_20 AC 26 ms
17,792 KB
testcase_21 AC 26 ms
17,920 KB
testcase_22 AC 26 ms
17,792 KB
testcase_23 AC 27 ms
17,792 KB
testcase_24 WA -
testcase_25 AC 27 ms
17,664 KB
testcase_26 AC 27 ms
17,920 KB
testcase_27 WA -
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;

class ASCASC2
{
	static int N, K;
	static List<int> firstList = new List<int>();
	static List<int> latterList = new List<int>();

	static void Main(String[] args)
	{
		String[] vals = Console.ReadLine().Split(' ');
		N = int.Parse(vals[0]);
		K = int.Parse(vals[1]);
		firstList.Add(K);
		Console.WriteLine(CountOK(1));
	}

	static int CountOK(int i)
	{
		int ret = 0;
		if(i > N)
		{
			int firstMax = 0;
			foreach(int  j in firstList)
			{
				if(firstMax < j)
					firstMax = j;
			}
			int latterMin = int.MaxValue;
			foreach(int j in latterList)
			{
				if(latterMin > j)
					latterMin = j;
			}
			if(firstMax > latterMin)
				return 1;
			else
				return 0;
		}
		if(i == K)
			return CountOK(i+1);

		if(i > K)
		{
			firstList.Add(i);
			ret+=CountOK(i+1);
			firstList.Remove(firstList.Count-1);
		}
		latterList.Add(i);
		ret+=CountOK(i+1);
		latterList.Remove(latterList.Count-1);

		return ret;
	}
}
0