結果
| 問題 |
No.1366 交換門松列・梅
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-20 13:08:52 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 828 bytes |
| コンパイル時間 | 184 ms |
| コンパイル使用メモリ | 5,504 KB |
| 実行使用メモリ | 39,296 KB |
| 最終ジャッジ日時 | 2024-09-21 13:35:49 |
| 合計ジャッジ時間 | 2,634 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 WA * 3 |
ソースコード
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"));