結果
問題 | No.202 1円玉投げ |
ユーザー |
![]() |
提出日時 | 2016-06-17 09:51:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 763 ms / 5,000 ms |
コード長 | 1,020 bytes |
コンパイル時間 | 2,465 ms |
コンパイル使用メモリ | 71,176 KB |
実行使用メモリ | 9,216 KB |
最終ジャッジ日時 | 2024-12-22 10:27:04 |
合計ジャッジ時間 | 11,449 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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:24:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 24 | scanf("%d%d",&X,&Y); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <vector> #include <map> #include <algorithm> #include <set> using namespace std; #define REP(i,s,e) for (i = s; i <= e; i++) #define rep(i,n) REP (i,0,(int)(n)-1) #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP (i,(int)(n)-1,0) #define INF (int)1e8 #define MOD (int)(1e9+7) typedef long long ll; set<int> coin[20001]; int main(void) { int i, n; scanf("%d",&n); rep (i,n) { int X, Y; scanf("%d%d",&X,&Y); int x; bool ok = true; REP (x,max(X-20,0),min(X+20,20000)) { for (int j = max(Y-20,0); j <= min(Y + 20,20000); j++) { auto py = coin[x].lower_bound(j); if (py != coin[x].end()) { int y = *py; ok &= (x - X) * (x - X) + (y - Y) * (y - Y) >= 400; } } } if (ok) coin[X].insert(Y); } int ans = 0; REP (i,0,20000) ans += coin[i].size(); printf("%d\n",ans); return 0; }