結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-05-03 23:45:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 957 ms / 5,000 ms |
| コード長 | 1,084 bytes |
| コンパイル時間 | 669 ms |
| コンパイル使用メモリ | 47,900 KB |
| 実行使用メモリ | 52,736 KB |
| 最終ジャッジ日時 | 2024-12-22 06:25:22 |
| 合計ジャッジ時間 | 15,793 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:26:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
26 | scanf("%d %d", &x, &y);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
// YukiCoderなら通る
#include <algorithm>
#include <cstdio>
#include <vector>
int N;
std::vector<std::vector<bool>> hasCircle;
int distance(int x1, int y1, int x2, int y2){
int dx = x1-x2, dy = y1-y2;
return dx * dx + dy * dy;
}
int main(){
hasCircle.resize(20001);
for(int i=0;i<=20000;i++){
hasCircle[i].resize(20001);
}
scanf("%d", &N);
int n = 0;
for(int i=0;i<N;i++){
int x, y;
scanf("%d %d", &x, &y);
bool flag = false;
for(int j=-20;j<=20;j++){
for(int k=-20;k<=20;k++){
int x2 = x + k, y2 = y + j;
if(x2 < 0 || x2 > 20000 || y2 < 0 || y2 > 20000){
continue;
}
if(!hasCircle[y2][x2]){continue;}
if(distance(x, y, x2, y2) < 400){
flag = true;
break;
}
}
if(flag){break;}
}
if(!flag){
hasCircle[y][x] = true;
n += 1;
}
}
printf("%d\n", n);
}
tottoripaper