結果

問題 No.290 1010
ユーザー 💕💖💞💕💖💞
提出日時 2017-07-01 11:12:53
言語 Kotlin
(1.9.23)
結果
TLE  
実行時間 -
コード長 523 bytes
コンパイル時間 12,589 ms
コンパイル使用メモリ 432,780 KB
実行使用メモリ 115,152 KB
最終ジャッジ日時 2024-04-30 15:09:37
合計ジャッジ時間 26,309 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 308 ms
60,432 KB
testcase_01 AC 307 ms
94,908 KB
testcase_02 AC 309 ms
56,996 KB
testcase_03 AC 308 ms
57,028 KB
testcase_04 AC 308 ms
57,068 KB
testcase_05 AC 308 ms
57,016 KB
testcase_06 AC 306 ms
57,140 KB
testcase_07 AC 312 ms
57,156 KB
testcase_08 AC 310 ms
57,068 KB
testcase_09 AC 309 ms
56,988 KB
testcase_10 AC 314 ms
57,044 KB
testcase_11 AC 309 ms
56,972 KB
testcase_12 AC 309 ms
56,976 KB
testcase_13 AC 312 ms
56,880 KB
testcase_14 AC 307 ms
56,988 KB
testcase_15 AC 309 ms
57,028 KB
testcase_16 AC 306 ms
57,100 KB
testcase_17 AC 308 ms
56,996 KB
testcase_18 AC 311 ms
57,096 KB
testcase_19 AC 307 ms
57,072 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:11: warning: parameter 'args' is never used
fun main( args : Array<String> ) {
          ^

ソースコード

diff #

fun main( args : Array<String> ) {
  val n  = readLine()!!.toInt()
  val ms = readLine()!!.toList().map { it.toString().toInt() }

  (0..n-1).map { j ->
    (0..j).map { i ->
      val k = j + 1
      val l = 2*j + 1 -i
      when {
        l >= ms.size -> null
        k >= ms.size -> null
        ms.slice(i..j) == ms.slice(k..l) -> true
        else -> null
      }
    }
  }.flatMap { 
    it 
  }.any { 
    it == true
  }.let {
     when(it) {
       true -> "YES"
       else -> "NO"
     }.let { println(it) }
  }
}
0