結果
| 問題 |
No.202 1円玉投げ
|
| コンテスト | |
| ユーザー |
tkmst201
|
| 提出日時 | 2017-05-20 17:18:20 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 159 ms / 5,000 ms |
| コード長 | 1,152 bytes |
| コンパイル時間 | 1,505 ms |
| コンパイル使用メモリ | 163,836 KB |
| 実行使用メモリ | 9,216 KB |
| 最終ジャッジ日時 | 2024-12-22 10:56:06 |
| 合計ジャッジ時間 | 4,645 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%d %d", &x, &y);
| ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;
int n;
set<int> sx[20001];
int main() {
cin >> n;
int ans = 0;
REP(i, n) {
int x, y;
scanf("%d %d", &x, &y);
bool ok = true;
FOR(j, -20, 21) {
if (!ok) break;
int nx = x + j;
if (nx >= 0 && nx <= 20000) {
set<int>::iterator it = sx[nx].lower_bound(y - 20);
while (ok && it != sx[nx].end() && *it <= y + 20) {
ll d = (x - nx) * (x - nx) + (y - *it) * (y - *it);
if (d < 400) ok = false;
it++;
}
}
}
if (ok) {
ans++;
sx[x].insert(y);
}
}
cout << ans << endl;
return 0;
}
tkmst201