結果

問題 No.1366 交換門松列・梅
ユーザー testtest
提出日時 2022-11-20 15:06:36
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 68 ms / 1,000 ms
コード長 717 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 5,232 KB
実行使用メモリ 37,572 KB
最終ジャッジ日時 2023-10-21 13:44:48
合計ジャッジ時間 1,816 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
37,572 KB
testcase_01 AC 57 ms
37,572 KB
testcase_02 AC 58 ms
37,572 KB
testcase_03 AC 57 ms
37,572 KB
testcase_04 AC 56 ms
37,572 KB
testcase_05 AC 61 ms
37,572 KB
testcase_06 AC 58 ms
37,572 KB
testcase_07 AC 57 ms
37,572 KB
testcase_08 AC 68 ms
37,572 KB
testcase_09 AC 58 ms
37,540 KB
testcase_10 AC 59 ms
37,572 KB
testcase_11 AC 58 ms
37,572 KB
testcase_12 AC 58 ms
37,572 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function isK(a) {
    if (a[0] == a[1] || a[0] == a[2] || a[1] == a[2]) return false;
    if ((a[0] > a[1] && a[2] > a[1]) || (a[0] < a[1] && a[2] < a[1])) {
        return true;
    } else {
        return false;
    }
}

function sub(a, b) {
    for (let i = 0; i <= 2; i++) {
        for (let j = 0; j <= 2; j++) {
            let c = [...a];
            let d = [...b];
            c[i] = b[j];
            d[j] = a[i];
            if (isK(c) && isK(d)) return "Yes";
        }
    }
    return "No";
}

function Main(input) {
    const src = input.split("\n");
    const a = src[0].split(" ");
    const b = src[1].split(" ");
    console.log(sub(a, b));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0