結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
Kmcode1
|
| 提出日時 | 2015-05-03 23:36:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 5,000 ms |
| コード長 | 1,258 bytes |
| コンパイル時間 | 1,157 ms |
| コンパイル使用メモリ | 97,416 KB |
| 実行使用メモリ | 9,344 KB |
| 最終ジャッジ日時 | 2024-12-22 06:11:31 |
| 合計ジャッジ時間 | 3,627 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:40:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
main.cpp:45:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
45 | scanf("%d%d", &x, &y);
| ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#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