結果
| 問題 | 
                            No.1366 交換門松列・梅
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-02-05 21:53:33 | 
| 言語 | Kotlin  (2.1.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 404 ms / 1,000 ms | 
| コード長 | 1,081 bytes | 
| コンパイル時間 | 14,306 ms | 
| コンパイル使用メモリ | 474,524 KB | 
| 実行使用メモリ | 62,444 KB | 
| 最終ジャッジ日時 | 2025-06-20 11:00:56 | 
| 合計ジャッジ時間 | 21,694 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 13 | 
ソースコード
import java.io.PrintWriter
import java.util.*
import kotlin.math.*
fun isKadomatsu(a: Array<Int>): Boolean {
    return a.distinct().size == 3 && (a[1] == a.max()!! || a[1] == a.min()!!)
}
fun PrintWriter.solve() {
    val a = Array(3) { nextInt() }
    val b = Array(3) { nextInt() }
    for (i in 0 until 3) {
        for (j in 0 until 3) {
            val c = a.copyOf()
            val d = b.copyOf()
            c[i] = b[j]
            d[j] = a[i]
            if (isKadomatsu(c) && isKadomatsu(d)) {
                println("Yes")
                return
            }
        }
    }
    println("No")
}
fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}
// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()
fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()!!
fun nextDouble() = next().toDouble()
// endregion