結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
158b
|
| 提出日時 | 2015-05-04 02:21:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,186 bytes |
| コンパイル時間 | 732 ms |
| コンパイル使用メモリ | 59,004 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-22 08:11:52 |
| 合計ジャッジ時間 | 3,003 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 15 WA * 23 |
ソースコード
//れっつバケット法
#include<iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
using namespace std;
//重なったら1 そうでなければ0
int check(int loc1x, int loc1y, int loc2x, int loc2y){
int kyori = abs(pow(loc2x - loc1x, 2) + pow(loc2y - loc1y, 2) );
//cout << "距離測定:" << loc1[0] << "," << loc1[0] << "と" << loc2[0] << "," << loc2[1] << ":" << kyori << endl;
if(kyori < 400){
return 1;
}
return 0;
}
int main(){
int max;
int count = 0;
int expand = 1000; //20000
int loc[100000][2];
int in1;
int in2;
int block[100000];
int myblock;
cin >> max;
for(int i=0; i<max; i++){
//データ入力部分
cin >> in1;
cin >> in2;
myblock = (in1 / expand) * 20 + in2 / expand;
loc[i][0] = in1;
loc[i][1] = in2;
block[i] = myblock;
//カウント部分
for(int i2=0; i2<i; i2++){
if(block[i] == myblock){
if(check(in1, in2 ,loc[myblock][0], loc[myblock][1]) == 1){
break;
}
}
}
if(loc[myblock][0] != -1){
count ++;
}
}
//中身確認
/*
for(int i=0; i<max; i++){
cout << loc[i][0] << "," << loc[i][1] << endl;
}
*/
cout << count << endl;
}
158b