結果
問題 | No.1265 Balloon Survival |
ユーザー | totori_nyaa |
提出日時 | 2020-10-23 22:12:01 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 168 ms / 2,000 ms |
コード長 | 1,316 bytes |
コンパイル時間 | 2,203 ms |
コンパイル使用メモリ | 204,088 KB |
実行使用メモリ | 12,996 KB |
最終ジャッジ日時 | 2023-09-28 16:00:07 |
合計ジャッジ時間 | 5,856 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,376 KB |
testcase_07 | AC | 2 ms
4,376 KB |
testcase_08 | AC | 2 ms
4,376 KB |
testcase_09 | AC | 2 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,376 KB |
testcase_11 | AC | 1 ms
4,380 KB |
testcase_12 | AC | 1 ms
4,380 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 10 ms
4,380 KB |
testcase_15 | AC | 8 ms
4,376 KB |
testcase_16 | AC | 4 ms
4,376 KB |
testcase_17 | AC | 66 ms
11,680 KB |
testcase_18 | AC | 5 ms
4,376 KB |
testcase_19 | AC | 4 ms
4,376 KB |
testcase_20 | AC | 10 ms
4,380 KB |
testcase_21 | AC | 22 ms
5,168 KB |
testcase_22 | AC | 14 ms
5,208 KB |
testcase_23 | AC | 15 ms
5,208 KB |
testcase_24 | AC | 159 ms
12,536 KB |
testcase_25 | AC | 153 ms
11,428 KB |
testcase_26 | AC | 149 ms
11,860 KB |
testcase_27 | AC | 145 ms
12,628 KB |
testcase_28 | AC | 147 ms
12,996 KB |
testcase_29 | AC | 148 ms
12,816 KB |
testcase_30 | AC | 153 ms
11,716 KB |
testcase_31 | AC | 152 ms
12,884 KB |
testcase_32 | AC | 168 ms
12,652 KB |
testcase_33 | AC | 153 ms
12,228 KB |
testcase_34 | AC | 2 ms
4,380 KB |
testcase_35 | AC | 2 ms
4,376 KB |
ソースコード
// #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' #define all(x) (x).begin(),(x).end() template<typename T1,typename T2> bool chmin(T1 &a,T2 b){if(a<=b)return 0; a=b; return 1;} template<typename T1,typename T2> bool chmax(T1 &a,T2 b){if(a>=b)return 0; a=b; return 1;} int dx[4]={0,1,0,-1}, dy[4]={1,0,-1,0}; long double eps = 1e-9; long double pi = acos(-1); struct S{ ll time; int l,r; bool operator>(const S &s) const{ return time > s.time; } }; signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20); int n; cin>>n; ll x[n],y[n]; for(int i=0;i<n;i++){ cin>>x[i]>>y[i]; } int ans = 0; bool used[n]={}; priority_queue<S,vector<S>,greater<S>> pq; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ ll dist = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]); pq.push({dist,i,j}); } } while(pq.size()){ auto [time,l,r] = pq.top(); pq.pop(); if(used[l] || used[r])continue; if(l!=0)used[l] = 1; used[r] = 1; if(l == 0)ans++; } cout << ans << endl; }