結果
| 問題 | 
                            No.2090 否定論理積と充足可能性
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-09-30 22:35:08 | 
| 言語 | Kotlin  (2.1.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,585 bytes | 
| コンパイル時間 | 15,335 ms | 
| コンパイル使用メモリ | 442,944 KB | 
| 実行使用メモリ | 59,244 KB | 
| 最終ジャッジ日時 | 2024-12-23 00:19:33 | 
| 合計ジャッジ時間 | 20,544 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 4 | 
ソースコード
import java.io.PrintWriter
import java.util.*
import kotlin.math.*
fun PrintWriter.solve() {
    val s = nextLine().split(" ")
    val num = Array(6) { 0 }
    for (i in 0 until 6) {
        for (j in 0 until i) {
            if (s[i] == s[j]) {
                num[i] = num[j]
                break
            }
        }
        num[i] = i
    }
    for (bits in 0 until 1.shl(6)) {
        val b = Array(6) { false }
        for (i in 0 until 6) {
            if ((bits.shr(i) and 1) != 0) {
                b[i] = true
            }
        }
        if (f(b[num[0]], b[num[1]], b[num[2]], b[num[3]], b[num[4]], b[num[5]])) {
            println("YES")
            return
        }
    }
    println("NO")
}
fun f(a0: Boolean, a1: Boolean, a2: Boolean, a3: Boolean, a4: Boolean, a5: Boolean) = ((a0 nand a1) nand a2) nand ((a3 nand a4) nand a5)
private infix fun Boolean.nand(a: Boolean) = !(this && a)
fun main() {
    Thread(null, {
        val writer = PrintWriter(System.out, false)
        writer.solve()
        writer.flush()
    }, "solve", abs(1L.shl(26)))
        .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } }
        .apply { start() }.join()
}
// 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