結果

問題 No.202 1円玉投げ
ユーザー aaa
提出日時 2015-05-05 12:59:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 335 ms / 5,000 ms
コード長 1,288 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 77,700 KB
実行使用メモリ 64,796 KB
最終ジャッジ日時 2024-12-22 08:32:16
合計ジャッジ時間 10,371 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 38
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

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[tx][ty]) {
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);
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0