結果

問題 No.1265 Balloon Survival
ユーザー kuuso1kuuso1
提出日時 2020-10-23 22:33:01
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 415 ms / 2,000 ms
コード長 1,787 bytes
コンパイル時間 4,632 ms
コンパイル使用メモリ 105,864 KB
実行使用メモリ 50,620 KB
最終ジャッジ日時 2023-09-28 16:39:36
合計ジャッジ時間 11,942 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
20,876 KB
testcase_01 AC 60 ms
18,672 KB
testcase_02 AC 60 ms
22,748 KB
testcase_03 AC 61 ms
20,772 KB
testcase_04 AC 62 ms
20,776 KB
testcase_05 AC 60 ms
18,600 KB
testcase_06 AC 61 ms
20,744 KB
testcase_07 AC 62 ms
22,812 KB
testcase_08 AC 62 ms
22,728 KB
testcase_09 AC 61 ms
20,748 KB
testcase_10 AC 62 ms
22,876 KB
testcase_11 AC 61 ms
20,660 KB
testcase_12 AC 63 ms
20,744 KB
testcase_13 AC 64 ms
22,740 KB
testcase_14 AC 85 ms
23,204 KB
testcase_15 AC 80 ms
21,212 KB
testcase_16 AC 69 ms
22,692 KB
testcase_17 AC 216 ms
39,884 KB
testcase_18 AC 73 ms
22,768 KB
testcase_19 AC 68 ms
20,704 KB
testcase_20 AC 83 ms
21,160 KB
testcase_21 AC 122 ms
30,364 KB
testcase_22 AC 94 ms
23,940 KB
testcase_23 AC 97 ms
23,940 KB
testcase_24 AC 412 ms
50,500 KB
testcase_25 AC 415 ms
48,416 KB
testcase_26 AC 403 ms
50,448 KB
testcase_27 AC 406 ms
48,472 KB
testcase_28 AC 400 ms
50,492 KB
testcase_29 AC 399 ms
48,404 KB
testcase_30 AC 398 ms
48,364 KB
testcase_31 AC 398 ms
50,568 KB
testcase_32 AC 408 ms
48,400 KB
testcase_33 AC 406 ms
50,620 KB
testcase_34 AC 61 ms
20,688 KB
testcase_35 AC 61 ms
18,708 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tiil = System.Tuple<int, int, long>;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	
	public void Solve(){
		
		List<Tiil> L = new List<Tiil>();
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				L.Add(new Tiil(i, j, (X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])));
			}
		}
		
		L.Sort((p, q) => p.Item3.CompareTo(q.Item3));
		
		int cnt = 0;
		bool[] disappear = new bool[N];
		foreach(var p in L){
			if(disappear[p.Item1] || disappear[p.Item2]) continue;
			if(p.Item1 != 0 && p.Item2 != 0){
				disappear[p.Item1] = true;
				disappear[p.Item2] = true;
				continue;
			}
			if(p.Item1 == 0 && p.Item2 != 0){
				disappear[p.Item2] = true;
				cnt++;
				continue;
			}
			if(p.Item1 != 0 && p.Item2 == 0){
				disappear[p.Item1] = true;
				cnt++;
				continue;
			}
		}
		
		Console.WriteLine(cnt);
		
		
	}
	int N;
	long[] X,Y;
	public Sol(){
		N = ri();
		X = new long[N];
		Y = new long[N];
		for(int i=0;i<N;i++){
			var d = ria();
			X[i] = d[0]; Y[i] = d[1];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0