結果

問題 No.1265 Balloon Survival
ユーザー 沙耶花沙耶花
提出日時 2020-10-23 22:13:12
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 593 ms / 2,000 ms
コード長 929 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 209,004 KB
実行使用メモリ 27,168 KB
最終ジャッジ日時 2023-09-28 16:01:49
合計ジャッジ時間 9,840 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 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 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 26 ms
6,044 KB
testcase_15 AC 19 ms
5,412 KB
testcase_16 AC 7 ms
4,376 KB
testcase_17 AC 199 ms
19,904 KB
testcase_18 AC 10 ms
4,648 KB
testcase_19 AC 8 ms
4,376 KB
testcase_20 AC 26 ms
5,896 KB
testcase_21 AC 71 ms
9,076 KB
testcase_22 AC 39 ms
7,592 KB
testcase_23 AC 45 ms
7,840 KB
testcase_24 AC 574 ms
26,956 KB
testcase_25 AC 576 ms
26,844 KB
testcase_26 AC 573 ms
26,840 KB
testcase_27 AC 579 ms
26,784 KB
testcase_28 AC 581 ms
26,788 KB
testcase_29 AC 587 ms
26,912 KB
testcase_30 AC 593 ms
26,836 KB
testcase_31 AC 577 ms
26,972 KB
testcase_32 AC 577 ms
27,168 KB
testcase_33 AC 573 ms
26,792 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000003

int main(){	
	
	int N;
	cin>>N;
	
	vector<long long> x(N),y(N);
	rep(i,N){
		cin>>x[i]>>y[i];
	}
	
	vector<pair<long long,pair<int,int>>> V;
	
	rep(i,N){
		for(int j=i+1;j<N;j++){
			V.emplace_back((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]),make_pair(i,j));
		}
	}
	
	sort(V.begin(),V.end());
	
	int ans = 0;
	
	while(V.size()!=0){
		vector<pair<long long,pair<int,int>>> nV;
		int a = V[0].second.first,b = V[0].second.second;
		if(a==0){
			ans ++;
			rep(j,V.size()){
				if(V[j].second.first==b||V[j].second.second==b)continue;
				nV.push_back(V[j]);
			}
		}
		else{
			rep(j,V.size()){
				if(V[j].second.first==a||V[j].second.first==b||V[j].second.second==a||V[j].second.second==b)continue;
				nV.push_back(V[j]);
			}
		}
		swap(V,nV);
	}
	
	cout<<ans<<endl;
	
    return 0;
}
0