結果

問題 No.1265 Balloon Survival
ユーザー yamakeyamake
提出日時 2020-10-23 22:29:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,495 bytes
コンパイル時間 1,004 ms
コンパイル使用メモリ 96,320 KB
実行使用メモリ 17,500 KB
最終ジャッジ日時 2023-09-28 16:35:33
合計ジャッジ時間 4,181 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 WA -
testcase_15 AC 12 ms
4,876 KB
testcase_16 WA -
testcase_17 AC 78 ms
17,080 KB
testcase_18 WA -
testcase_19 AC 6 ms
4,380 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 23 ms
6,280 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define debug(output) cout<<#output<<"= "<<output<<endl
using lint=long long;
using P= pair<lint,lint>;
int MOD=1000000007;
int d2(P& a,P& b){
    return (a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second);
}

signed main(){
    int n;cin>>n;
    vector<pair<lint,lint>> b(n);
    rep(i,n)cin>>b[i].first>>b[i].second;
    priority_queue<pair<lint,P>,vector<pair<lint,P>>,greater<>> que;
    rep(i,n){
        for(int j=i+1;j<n;++j){
            que.push({d2(b[i],b[j]),{i,j}});
        }
    }
    vector<int> memo(n,0);
    int res=0;
    map<int,int> hoge;
    lint dist=0;
    while(!que.empty()){
        auto buf=que.top();que.pop();
        if(dist!=buf.first){
            dist=buf.first;
            for(auto& val:hoge){
                memo[val.first]=1;
            }
            hoge.clear();
        }
        if(memo[buf.second.first]>0||memo[buf.second.second]>0){
                continue;
            }
        if(buf.second.first==0||buf.second.second==0){
            ++res;
            hoge[buf.second.first+buf.second.second]=1;
        }
        else{
            hoge[buf.second.first]=1;
            hoge[buf.second.second]=1;
        }
    }
    cout<<res<<"\n";
    return 0;
}
0