結果
| 問題 |
No.1366 交換門松列・梅
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-20 14:03:10 |
| 言語 | JavaScript (node v23.5.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 291 ms |
| コンパイル使用メモリ | 6,944 KB |
| 実行使用メモリ | 41,464 KB |
| 最終ジャッジ日時 | 2024-09-21 14:16:56 |
| 合計ジャッジ時間 | 2,054 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 6 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];
c[j] = a[i];
d[i] = b[j];
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"));