結果

問題 No.607 開通777年記念
ユーザー 💕💖💞💕💖💞
提出日時 2018-02-16 15:33:00
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 767 bytes
コンパイル時間 13,893 ms
コンパイル使用メモリ 444,560 KB
実行使用メモリ 123,872 KB
最終ジャッジ日時 2024-04-30 16:58:12
合計ジャッジ時間 23,206 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 334 ms
60,464 KB
testcase_01 AC 350 ms
95,196 KB
testcase_02 AC 345 ms
63,836 KB
testcase_03 AC 343 ms
56,860 KB
testcase_04 AC 340 ms
57,052 KB
testcase_05 AC 338 ms
57,124 KB
testcase_06 AC 331 ms
57,068 KB
testcase_07 AC 896 ms
92,988 KB
testcase_08 AC 370 ms
57,136 KB
testcase_09 AC 684 ms
89,040 KB
testcase_10 AC 497 ms
66,160 KB
testcase_11 TLE -
testcase_12 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args: Array<String>) { 
         ^
Main.kt:19:9: warning: name shadowed: xs
    val xs = xsn!! 
        ^

ソースコード

diff #

fun main(args: Array<String>) { 
  val (ws, n) = readLine()!!.split(" ").map { it.toInt() }
  val xs = (1..ws).map { 0 }.toMutableList()
  
  var check = false
  (1..n).map { 
    val arr = readLine()!!.split(" ").map { it.toInt() }
      
    when  { 
      arr.sum() != 0 -> { arr.mapIndexed { index, x ->
            xs[index] += x
          }
          xs.toList()
        }
      else -> null
    }
  }.filter { it != null }
  .map { xsn ->
    val xs = xsn!! 
    if( check == false ) {
      scan@for( s in (0..xs.size-1) ) { 
        for( e in (s..xs.size-1) ) { 
          if( xs.slice(s..e).sum() == 777) {
            check = true
            continue@scan
          }
        }
      }
    }
  }

  if(check) 
    println("YES")
  else
    println("NO")
}
0