結果
問題 | No.96 圏外です。 |
ユーザー | 14番 |
提出日時 | 2016-04-11 21:14:12 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 5,296 bytes |
コンパイル時間 | 823 ms |
コンパイル使用メモリ | 119,452 KB |
実行使用メモリ | 34,732 KB |
最終ジャッジ日時 | 2024-10-04 06:38:12 |
合計ジャッジ時間 | 15,015 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 33 ms
24,244 KB |
testcase_01 | AC | 33 ms
28,556 KB |
testcase_02 | AC | 35 ms
26,472 KB |
testcase_03 | AC | 22 ms
23,544 KB |
testcase_04 | AC | 215 ms
32,636 KB |
testcase_05 | AC | 575 ms
30,948 KB |
testcase_06 | AC | 1,395 ms
33,132 KB |
testcase_07 | AC | 3,392 ms
33,856 KB |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; int tyukeiCount = int.Parse(Reader.ReadLine()); List<Pos> tyukeiList = new List<Pos>(); for (int i = 0; i < tyukeiCount; i++) { tyukeiList.Add(new Pos(Reader.GetInt())); } if (tyukeiList.Count == 0) { Console.WriteLine(1); return; } else if (tyukeiList.Count == 1) { Console.WriteLine(2); return; } long maxLen2 = 0; List<List<Pos>> groupList = new List<List<Pos>>(); foreach (Pos pos in tyukeiList) { List<Pos> tmp = new List<Pos>(tyukeiList.FindAll(a=> ((pos.X - a.X)*(pos.X - a.X)+(pos.Y - a.Y)*(pos.Y - a.Y)) <= 100)); List<List<Pos>> mergeList = new List<List<Pos>>(); List<Pos> otherList = new List<Pos>(); tmp.ForEach((a) => { bool grouped = false; groupList.ForEach((b) => { if (b.Contains(a)) { grouped = true; if (!mergeList.Contains(b)) { mergeList.Add(b); } } }); if (!grouped) { otherList.Add(a); } }); mergeList.ForEach((a) => { groupList.Remove(a); otherList.AddRange(a); }); if (otherList.Count > 0) { groupList.Add(otherList); } } groupList.ForEach(a => maxLen2 = Math.Max(maxLen2, GetLen2(a))); double ans = 2; if (maxLen2 > 0) { ans = Math.Sqrt(maxLen2) + 2; } Console.WriteLine(ans.ToString("#################################0.#############")); } private long GetLen2(List<Pos> src) { List<Pos> target = new List<Pos>(); List<Pos> work = new List<Pos>(src.OrderBy(a=>a.X)); for (int i = 0; i < Math.Min(5, work.Count); i++) { if (!target.Contains(work[i])) { target.Add(work[i]); } } work.Reverse(); for (int i = 0; i < Math.Min(5, work.Count); i++) { if (!target.Contains(work[i])) { target.Add(work[i]); } } work = new List<Pos>(src.OrderBy(a => a.Y)); for (int i = 0; i < Math.Min(5, work.Count); i++) { if (!target.Contains(work[i])) { target.Add(work[i]); } } work.Reverse(); for (int i = 0; i < Math.Min(5, work.Count); i++) { if (!target.Contains(work[i])) { target.Add(work[i]); } } work = new List<Pos>(src.OrderBy(a => Math.Abs(a.X) + Math.Abs(a.Y))); for (int i = 0; i < Math.Min(5, work.Count); i++) { if (!target.Contains(work[i])) { target.Add(work[i]); } } work.Reverse(); for (int i = 0; i < Math.Min(5, work.Count); i++) { if (!target.Contains(work[i])) { target.Add(work[i]); } } long ans = 0; for (int i = 0; i < target.Count - 1; i++) { for (int j = i + 1; j < target.Count; j++) { long tmp = (target[i].X - target[j].X) * (target[i].X - target[j].X); tmp += (target[i].Y - target[j].Y) * (target[i].Y - target[j].Y); ans = Math.Max(ans, tmp); } } return ans; } public class Pos { public long X; public long Y; public Pos(int[] pos) { this.X = pos[0]; this.Y = pos[1]; } } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 2 3 3 12 1 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ', bool trim = false) { string inptStr = ReadLine(); if (trim) { inptStr = inptStr.Trim(); } string[] inpt = inptStr.Split(delimiter); int[] ret = new int[inpt.Length]; for (int i = 0; i < inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } } static void Main() { Program prg = new Program(); prg.Proc(); } }