結果
問題 | No.202 1円玉投げ |
ユーザー |
|
提出日時 | 2015-05-03 23:50:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2,369 ms / 5,000 ms |
コード長 | 413 bytes |
コンパイル時間 | 480 ms |
コンパイル使用メモリ | 42,240 KB |
実行使用メモリ | 7,808 KB |
最終ジャッジ日時 | 2024-12-22 06:29:00 |
合計ジャッジ時間 | 13,509 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::set<std::pair<int, int> >::size_type’ {aka ‘long unsigned int’} [-Wformat=] 19 | printf("%d\n",se.size()); | ~^ ~~~~~~~~~ | | | | int std::set<std::pair<int, int> >::size_type {aka long unsigned int} | %ld main.cpp:9:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | for(scanf("%d",&N);N--;){ | ~~~~~^~~~~~~~~ main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d%d",&x,&y); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <set> #include <cstdio> using namespace std; typedef pair<int,int> pii; int main(){ set<pii>se; int N; for(scanf("%d",&N);N--;){ int x,y; scanf("%d%d",&x,&y); pii A={x-20,0},B={x+20,1<<30}; auto a=se.lower_bound(A),b=se.upper_bound(B); for(;a!=b;++a){ if((a->first-x)*(a->first-x) + (a->second-y)*(a->second-y) < 400)break; } if(a==b)se.insert({x,y}); } printf("%d\n",se.size()); }