結果
問題 |
No.678 2Dシューティングゲームの必殺ビーム
|
ユーザー |
|
提出日時 | 2020-03-21 18:40:00 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 282 ms / 2,000 ms |
コード長 | 1,296 bytes |
コンパイル時間 | 1,852 ms |
コンパイル使用メモリ | 77,656 KB |
実行使用メモリ | 58,324 KB |
最終ジャッジ日時 | 2024-12-23 07:46:29 |
合計ジャッジ時間 | 6,726 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
import java.io.FileNotFoundException; import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws FileNotFoundException { long t = System.currentTimeMillis(); new Main().run(); System.err.println(System.currentTimeMillis() - t); } Scanner sc = new Scanner(System.in); void run() { int N=sc.nextInt(); int L=sc.nextInt(); int R=sc.nextInt(); int[][] map=new int[2700][1300]; for(int i=0;i<map.length;++i)for(int j=0;j<map[i].length;++j)map[i][j]=-1; for(int n=0;n<N;++n) { int xl=Math.max(L,sc.nextInt()); int yu=sc.nextInt()+501; int xr=Math.min(R,sc.nextInt()); int yd=sc.nextInt()+501; for(int x=xl;x<=xr;++x) { for(int y=yu;y<=yd;++y) { if(map[y][x]!=-1)throw new AssertionError(); map[y][x]=n; } } } boolean[] hit=new boolean[N]; for(int i=0;i<map[map.length-1].length;++i)map[map.length-1][i]=-2; for(int h=map.length-2;h>=0;--h) { for(int w=0;w<map[h].length;++w) { if(map[h+1][w]!=-2)continue; if(map[h][w]==-1) { map[h][w]=-2; }else { hit[map[h][w]]=true; } } } for(int i=0;i<N;++i) { System.out.println(hit[i]?1:0); } } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }