結果
| 問題 | No.202 1円玉投げ |
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2015-05-03 23:36:34 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 101 ms / 5,000 ms |
| コード長 | 1,258 bytes |
| 記録 | |
| コンパイル時間 | 1,017 ms |
| コンパイル使用メモリ | 116,080 KB |
| 実行使用メモリ | 9,600 KB |
| 最終ジャッジ日時 | 2026-05-28 14:54:21 |
| 合計ジャッジ時間 | 2,939 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
ソースコード
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;
int n;
set<int> s[20010];
int dist(int a, int b, int c, int d){
if (a < c){
swap(a, c);
}
if (b < d){
swap(b, d);
}
return (a - c)*(a - c) + (b - d)*(b - d);
}
int main(){
scanf("%d", &n);
set<int>::iterator ite;
int countt = 0;
for (int i = 0; i < n; i++){
int x, y;
scanf("%d%d", &x, &y);
int mint = max(0, x - 19);
int maxt = x + 19;
bool ok = false;
for (int j = mint; j <= maxt; j++){
if (s[j].size() == 0){
continue;
}
ite = s[j].lower_bound(y);
if (ite != s[j].end()){
if (dist(x,y,j,(*ite)) < 400){
ok = true;
break;
}
}
if (ite != s[j].begin()){
ite--;
if (dist(x,y,j,(*ite)) < 400){
ok = true;
break;
}
}
}
if (ok == false){
s[x].insert(y);
countt++;
}
}
printf("%d\n", countt);
return 0;
}
Kmcode1