結果
| 問題 | No.1366 交換門松列・梅 |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2021-01-29 21:35:10 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 1,000 ms |
| + 130µs | |
| コード長 | 862 bytes |
| 記録 | |
| コンパイル時間 | 3,523 ms |
| コンパイル使用メモリ | 84,288 KB |
| 実行使用メモリ | 45,620 KB |
| 最終ジャッジ日時 | 2026-07-12 12:43:42 |
| 合計ジャッジ時間 | 4,240 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int[] a = new int[3];
for (int i = 0; i < 3; i++) {
a[i] = sc.nextInt();
}
int[] b = new int[3];
for (int i = 0; i < 3; i++) {
b[i] = sc.nextInt();
}
sc.close();
if (check(a) && check(b)) {
System.out.println("Yes");
return;
}
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
int t = a[i];
a[i] = b[j];
b[j] = t;
if (check(a) && check(b)) {
System.out.println("Yes");
return;
}
t = a[i];
a[i] = b[j];
b[j] = t;
}
}
System.out.println("No");
}
static boolean check(int[] a) {
if (a[0] != a[2]) {
if (a[0] < a[1] && a[1] > a[2]) return true;
if (a[0] > a[1] && a[1] < a[2]) return true;
}
return false;
}
}
ks2m