結果

問題 No.1463 Hungry Kanten
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-08 20:26:19
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 944 bytes
コンパイル時間 3,324 ms
コンパイル使用メモリ 155,948 KB
実行使用メモリ 16,048 KB
最終ジャッジ日時 2023-10-14 18:21:27
合計ジャッジ時間 6,867 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,368 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 WA -
testcase_03 AC 445 ms
4,368 KB
testcase_04 AC 3 ms
4,368 KB
testcase_05 AC 1,325 ms
16,048 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 AC 1 ms
4,368 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 3 ms
4,372 KB
testcase_11 AC 3 ms
4,368 KB
testcase_12 AC 4 ms
4,368 KB
testcase_13 AC 3 ms
4,372 KB
testcase_14 AC 11 ms
4,372 KB
testcase_15 AC 6 ms
4,372 KB
testcase_16 AC 34 ms
4,496 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 597 ms
9,968 KB
testcase_20 AC 807 ms
11,312 KB
testcase_21 AC 3 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var k: int :: cui@inputInt()
	var a: []int :: #[n]int
	for i(0, n - 1)
		do a[i] :: cui@inputInt()
	end for
	
	var rnd: lib@Rnd :: lib@makeRnd(lib@sysTime() $ bit32)
	var ans: int :: 0
	for(1, 4)
		var map: dict<int, bool> :: #dict<int, bool>
		var mod: int :: rnd.rnd(lib@intMax / 2, lib@intMax)
		for ii(0, 2 ^ n - 1)
			var id: int :: ii
			var use: []bool :: #[n]bool
			var cnt: int :: 0
			for i(0, n - 1)
				if(id % 2 = 1)
					do use[i] :: true
					do cnt :+ 1
				end if
				do id :/ 2
			end for
			if(cnt >= k)
				var mul: int :: 1
				for i(0, n - 1)
					if(use[i])
						do mul :* a[i]
						do mul :% mod
					end if
				end for
				do map.add(mul, true)
				
				var sum: int :: 0
				for i(0, n - 1)
					if(use[i])
						do sum :+ a[i]
					end if
				end for
				do map.add(sum, true)
			end if
		end for
		do ans :: [ans, ^map].max()
	end for
	do cui@print("\{ans}\n")
end func
0