結果
| 問題 |
No.678 2Dシューティングゲームの必殺ビーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-10 02:41:07 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,112 bytes |
| コンパイル時間 | 3,453 ms |
| コンパイル使用メモリ | 77,212 KB |
| 実行使用メモリ | 54,776 KB |
| 最終ジャッジ日時 | 2024-06-30 13:09:09 |
| 合計ジャッジ時間 | 7,126 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 14 WA * 4 |
ソースコード
import java.util.*;
public class No678{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int xLB = sc.nextInt();
int xRB = sc.nextInt();
int[] beam = new int[1281];
Arrays.fill(beam, xLB, xRB+1, 1);
int[][] positions = new int[N][4];
for(int n = 0; n < N; n++){
for(int i = 0; i < 4; i++){
positions[n][i] = sc.nextInt();
}
}
int[] is_hit = new int[N];
Arrays.fill(is_hit, 0);
for(int h = 1680; h > 0; h--){
for(int n = 0; n < N; n++){
if(is_hit[n] == 1) continue;
if(h < positions[n][3] && is_beam(beam, positions[n][0], positions[n][2])){
is_hit[n] = 1;
Arrays.fill(beam,
Math.max(positions[n][0], 0),
Math.min(positions[n][2]+1, 1281),
0);
// System.out.println("enemy " + n + " hit");
}
}
}
for(int n = 0; n < N; n++){
System.out.println(is_hit[n]);
}
}
private static boolean is_beam(int[] beam, int l, int r){
l = Math.max(0, l);
r = Math.min(r, 1281);
for(int x = l; x < r; x++){
if(beam[x] == 1) return true;
}
return false;
}
}