結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-05 22:24:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 616 ms / 5,000 ms |
| コード長 | 912 bytes |
| コンパイル時間 | 810 ms |
| コンパイル使用メモリ | 67,308 KB |
| 実行使用メモリ | 53,120 KB |
| 最終ジャッジ日時 | 2024-12-22 08:33:41 |
| 合計ジャッジ時間 | 11,744 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
const int XY_MAX = 20000;
const int R = 10;
const int LEN = 2 * R;
const int LEN2 = LEN * LEN;
vector< vector<bool> > board;
bool possible(int x, int y) {
int dx, dy, nx, ny;
for (dx = -LEN; dx <= LEN; dx++) {
nx = x + dx;
if (nx < 0 || XY_MAX < nx) {
continue;
}
for (dy = -LEN; dy <= LEN; dy++) {
ny = y + dy;
if (ny < 0 || XY_MAX < ny) {
continue;
}
if (dx * dx + dy * dy >= LEN2) {
continue;
}
if (board[ny][nx]) {
return false;
}
}
}
return true;
}
int main() {
int n, x, y;
board.assign(XY_MAX + 1, vector<bool>(XY_MAX + 1, false));
cin >> n;
int coin = 0;
for (int i = 0; i < n; i++) {
cin >> x >> y;
if (possible(x, y)) {
coin++;
board[y][x] = true;
}
}
cout << coin << endl;
return 0;
}