結果
問題 |
No.202 1円玉投げ
|
ユーザー |
|
提出日時 | 2015-05-12 03:02:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 596 ms / 5,000 ms |
コード長 | 675 bytes |
コンパイル時間 | 494 ms |
コンパイル使用メモリ | 52,608 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2024-12-22 09:03:24 |
合計ジャッジ時間 | 6,451 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 38 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27: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=] 27 | printf("%d\n",se.size()); | ~^ ~~~~~~~~~ | | | | int std::set<std::pair<int, int> >::size_type {aka long unsigned int} | %ld main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d%d",&x,&y); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <vector> #include <set> #include <cstdio> using namespace std; typedef pair<int,int> pii; int main(){ int N; scanf("%d",&N); vector<pair<int,int> >v(N); set<int>kindx,kindy; for(int i=0;i<N;i++){ int x,y; scanf("%d%d",&x,&y); v[i]={x,y}; kindx.insert(x),kindy.insert(y); } if(kindx.size()<kindy.size())for(int i=0;i<N;i++)swap(v[i].first,v[i].second); set<pii>se; for(int i=0;i<N;i++){ int x=v[i].first,y=v[i].second; 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()); }