結果
問題 |
No.202 1円玉投げ
|
ユーザー |
![]() |
提出日時 | 2015-05-05 12:55:03 |
言語 | Java (openjdk 23) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,288 bytes |
コンパイル時間 | 5,815 ms |
コンパイル使用メモリ | 76,512 KB |
実行使用メモリ | 45,840 KB |
最終ジャッジ日時 | 2024-12-22 08:31:19 |
合計ジャッジ時間 | 6,258 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 RE * 37 |
ソースコード
package y202; import java.io.IOException; import java.util.ArrayList; public class Main { static int nextInt() { int c; try { c = System.in.read(); while(c != '-' && (c < '0' || c > '9')) c = System.in.read(); if(c == '-') return -nextInt(); int res = 0; while(c >= '0' && c <= '9') { res = res * 10 + c - '0'; c = System.in.read(); } return res; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return -1; } public static void main(String[] args) { int LEN = 1002; int N = nextInt(); ArrayList<int[]> B[][] = new ArrayList[LEN][LEN]; int ans = 0; L:for(int i = 0; i < N; i++) { int x = nextInt(); int y = nextInt(); int ix = x/20; int iy = y/20; for(int dx = -1; dx <= 1; dx++) for(int dy = -1; dy <= 1; dy++) { int tx = ix + dx; int ty = iy + dy; if(tx < 0 || LEN <= tx || ty < 0 || LEN <= ty || B[tx][ty] == null) continue; for(int c[]: B[ty][tx]) { int ox = c[0]; int oy = c[1]; if((ox - x)*(ox - x) + (oy - y)*(oy - y) < 400) { continue L; } } } if(B[ix][iy] == null) { B[ix][iy] = new ArrayList<int[]>(); } B[ix][iy].add(new int[]{x, y}); ans++; } System.out.println(ans); } }