結果

問題 No.1463 Hungry Kanten
ユーザー 👑 tatt61880tatt61880
提出日時 2021-04-08 20:21:24
言語 Kuin
(KuinC++ v.2021.9.17)
結果
WA  
実行時間 -
コード長 946 bytes
コンパイル時間 2,485 ms
コンパイル使用メモリ 156,056 KB
実行使用メモリ 8,744 KB
最終ジャッジ日時 2023-10-14 18:20:53
合計ジャッジ時間 7,116 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,248 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 WA -
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

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, 100)
		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