結果

問題 No.4 おもりと天秤
ユーザー firiexpfiriexp
提出日時 2019-04-07 16:47:04
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 337 ms / 5,000 ms
コード長 442 bytes
コンパイル時間 12,051 ms
コンパイル使用メモリ 435,800 KB
実行使用メモリ 57,100 KB
最終ジャッジ日時 2024-04-30 20:14:12
合計ジャッジ時間 20,741 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 320 ms
56,980 KB
testcase_01 AC 320 ms
56,916 KB
testcase_02 AC 317 ms
56,956 KB
testcase_03 AC 320 ms
56,916 KB
testcase_04 AC 321 ms
57,056 KB
testcase_05 AC 324 ms
57,084 KB
testcase_06 AC 321 ms
56,908 KB
testcase_07 AC 336 ms
57,100 KB
testcase_08 AC 327 ms
56,948 KB
testcase_09 AC 332 ms
56,960 KB
testcase_10 AC 332 ms
57,064 KB
testcase_11 AC 319 ms
56,880 KB
testcase_12 AC 315 ms
56,948 KB
testcase_13 AC 322 ms
56,944 KB
testcase_14 AC 327 ms
56,716 KB
testcase_15 AC 318 ms
56,940 KB
testcase_16 AC 317 ms
56,988 KB
testcase_17 AC 320 ms
56,816 KB
testcase_18 AC 330 ms
56,968 KB
testcase_19 AC 332 ms
57,100 KB
testcase_20 AC 337 ms
57,084 KB
testcase_21 AC 337 ms
56,988 KB
testcase_22 AC 332 ms
57,076 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:3:10: warning: parameter 'args' is never used
fun main(args: Array<String>) {
         ^
Main.kt:4:9: warning: variable 'n' is never used
    val n = readLine()!!.toInt()
        ^

ソースコード

diff #

import java.math.BigInteger

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val v = readLine()!!.split(" ").map(String::toInt)
    val sum = v.sum()
    if(sum % 2 != 0){
        println("impossible");
        return
    }
    var ans = BigInteger.ONE
    for (i in v){
        ans = ans.or(ans.shiftLeft(i))
    }
    if(ans.testBit(sum/2)){
        println("possible")
    }else {
        println("impossible")
    }
}
0