結果
問題 | No.1265 Balloon Survival |
ユーザー |
|
提出日時 | 2020-10-24 01:28:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 849 ms |
コンパイル使用メモリ | 78,148 KB |
実行使用メモリ | 13,452 KB |
最終ジャッジ日時 | 2024-07-21 14:43:53 |
合計ジャッジ時間 | 2,141 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> #include<vector> using namespace std; int N; long x[1000],y[1000]; bool ex[1000]; main() { cin>>N; for(int i=0;i<N;i++) { cin>>x[i]>>y[i]; ex[i]=true; } vector<pair<long,pair<int,int> > >A; for(int i=0;i<N;i++)for(int j=i+1;j<N;j++) { A.push_back(make_pair((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]),make_pair(i,j))); } sort(A.begin(),A.end()); int cnt=0; for(int i=0;i<A.size();i++) { int u=A[i].second.first,v=A[i].second.second; if(u==0) { if(ex[v]) { cnt++; ex[v]=false; } } else { if(ex[u]&&ex[v]) { ex[u]=ex[v]=false; } } } cout<<cnt<<endl; }