結果
問題 |
No.870 無敵囲い
|
ユーザー |
![]() |
提出日時 | 2019-08-30 23:39:17 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 54 ms / 300 ms |
コード長 | 946 bytes |
コンパイル時間 | 1,994 ms |
コンパイル使用メモリ | 76,116 KB |
実行使用メモリ | 37,028 KB |
最終ジャッジ日時 | 2024-06-29 06:21:27 |
合計ジャッジ時間 | 3,900 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[][] x = new int[n][4]; for (int i = 0; i < n; i++) { String[] sa = br.readLine().split(" "); for (int j = 0; j < 4; j++) { x[i][j] = Integer.parseInt(sa[j]); } } br.close(); int[][] a = new int[3][]; a[0] = new int[]{2, 8}; a[1] = new int[]{3, 9}; a[2] = new int[]{7, 9}; for (int i = 0; i < n; i++) { for (int j = 0; j < a.length; j++) { if (x[i][0] == a[j][0] && x[i][1] == a[j][1]) { a[j][0] = x[i][2]; a[j][1] = x[i][3]; } } } if (a[0][0] == 5 && a[0][1] == 8 && a[1][0] == 4 && a[1][1] == 8 && a[2][0] == 6 && a[2][1] == 8) { System.out.println("YES"); } else { System.out.println("NO"); } } }