結果

問題 No.290 1010
ユーザー 💕💖💞💕💖💞
提出日時 2017-07-01 11:23:42
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 544 ms / 5,000 ms
コード長 669 bytes
コンパイル時間 13,066 ms
コンパイル使用メモリ 437,800 KB
実行使用メモリ 76,068 KB
最終ジャッジ日時 2024-04-30 15:11:27
合計ジャッジ時間 23,237 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 330 ms
57,008 KB
testcase_01 AC 328 ms
57,064 KB
testcase_02 AC 329 ms
57,052 KB
testcase_03 AC 329 ms
56,920 KB
testcase_04 AC 337 ms
56,972 KB
testcase_05 AC 334 ms
56,912 KB
testcase_06 AC 330 ms
56,912 KB
testcase_07 AC 327 ms
57,024 KB
testcase_08 AC 332 ms
56,988 KB
testcase_09 AC 331 ms
57,028 KB
testcase_10 AC 330 ms
56,936 KB
testcase_11 AC 332 ms
57,020 KB
testcase_12 AC 327 ms
56,888 KB
testcase_13 AC 337 ms
57,064 KB
testcase_14 AC 324 ms
56,716 KB
testcase_15 AC 334 ms
56,916 KB
testcase_16 AC 327 ms
56,928 KB
testcase_17 AC 329 ms
56,864 KB
testcase_18 AC 327 ms
56,940 KB
testcase_19 AC 329 ms
56,880 KB
testcase_20 AC 535 ms
75,812 KB
testcase_21 AC 538 ms
75,820 KB
testcase_22 AC 539 ms
75,996 KB
testcase_23 AC 544 ms
76,068 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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() }
  when { 
    n > 3 -> println("YES")
    else -> { 
      (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