結果
問題 | No.1265 Balloon Survival |
ユーザー |
![]() |
提出日時 | 2020-10-23 22:14:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 104 ms / 2,000 ms |
コード長 | 1,407 bytes |
コンパイル時間 | 1,829 ms |
コンパイル使用メモリ | 182,472 KB |
実行使用メモリ | 15,972 KB |
最終ジャッジ日時 | 2024-07-21 10:47:28 |
合計ジャッジ時間 | 4,070 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 32 |
ソースコード
#include<bits/stdc++.h>using namespace std;#define int long long#define REP(i,m,n) for(int i=(m);i<(n);i++)#define rep(i,n) REP(i,0,n)#define pb push_back#define all(a) a.begin(),a.end()#define rall(c) (c).rbegin(),(c).rend()#define mp make_pair#define endl '\n'#define vec vector<ll>#define mat vector<vector<ll> >#define fi first#define se secondtypedef long long ll;typedef unsigned long long ull;typedef pair<ll,ll> pll;typedef long double ld;typedef complex<double> comp;const ll INF=1e9+7;const ll inf=INF*INF;const ll MOD=1e9+7;const ll mod=MOD;const int MAX=200010;signed main(){ll n;cin>>n;vector<ll>x(n),y(n);rep(i,n){cin>>x[i]>>y[i];}vector<pair<ll,pll> >d(0);rep(i,n){REP(j,i+1,n){pair<ll,pll>p;p.fi=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);p.se.fi=i;p.se.se=j;d.pb(p);}}sort(all(d));set<ll>st;ll ans=0;rep(i,d.size()){ll x=d[i].se.fi;ll y=d[i].se.se;if(st.find(x)==st.end()){if(st.find(y)==st.end()){if(x!=0)st.insert(x);if(y!=0)st.insert(y);if(x==0)ans++;if(y==0)ans++;}else{continue;}}else{continue;}}cout<<ans<<endl;}