結果
| 問題 | No.1366 交換門松列・梅 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-20 13:08:52 |
| 言語 | JavaScript (node v25.8.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 828 bytes |
| 記録 | |
| コンパイル時間 | 40 ms |
| コンパイル使用メモリ | 7,840 KB |
| 実行使用メモリ | 54,716 KB |
| 最終ジャッジ日時 | 2026-04-09 19:00:38 |
| 合計ジャッジ時間 | 3,306 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 5 |
ソースコード
function isK(a) {
if (a[0] == a[1] || a[0] == a[2] || a[1] == a[2]) return false;
if (!(a[0] > a[1] && a[1] < a[2]) || (a[0] < a[1] && a[1] > a[2])) return false;
return true;
}
function sub(a, b) {
let as = [...a];
let bs = [...b];
as.sort();
bs.sort();
if (as == bs) return "No";
for (let i = 0; i <= 2; i++) {
for (let j = 0; j <= 2; j++) {
let c = [...a];
let d = [...b];
let e = a[i];
let f = b[i];
c[j] = f;
d[i] = e;
if (isK(c) && isK(d)) return "Yes";
}
}
return "No";
}
function Main(input) {
let src = input.split("\n");
let a = src[0].split(" ");
let b = src[1].split(" ");
console.log(sub(a, b));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));