結果
問題 | No.101 ぐるぐる!あみだくじ! |
ユーザー | 14番 |
提出日時 | 2016-04-12 01:30:45 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,541 bytes |
コンパイル時間 | 828 ms |
コンパイル使用メモリ | 113,436 KB |
実行使用メモリ | 56,440 KB |
最終ジャッジ日時 | 2024-10-04 06:59:18 |
合計ジャッジ時間 | 14,029 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 22 ms
24,740 KB |
testcase_01 | AC | 223 ms
56,440 KB |
testcase_02 | AC | 224 ms
54,384 KB |
testcase_03 | AC | 30 ms
25,300 KB |
testcase_04 | AC | 30 ms
25,436 KB |
testcase_05 | AC | 63 ms
27,532 KB |
testcase_06 | AC | 30 ms
27,288 KB |
testcase_07 | AC | 45 ms
31,224 KB |
testcase_08 | AC | 42 ms
27,620 KB |
testcase_09 | AC | 36 ms
27,280 KB |
testcase_10 | AC | 33 ms
27,032 KB |
testcase_11 | AC | 449 ms
31,344 KB |
testcase_12 | AC | 470 ms
31,104 KB |
testcase_13 | AC | 463 ms
31,492 KB |
testcase_14 | AC | 627 ms
29,428 KB |
testcase_15 | AC | 77 ms
31,616 KB |
testcase_16 | AC | 87 ms
23,296 KB |
testcase_17 | AC | 95 ms
23,424 KB |
testcase_18 | AC | 103 ms
23,424 KB |
testcase_19 | AC | 118 ms
23,040 KB |
testcase_20 | AC | 37 ms
23,168 KB |
testcase_21 | AC | 40 ms
23,040 KB |
testcase_22 | AC | 164 ms
23,296 KB |
testcase_23 | AC | 112 ms
23,168 KB |
testcase_24 | AC | 1,229 ms
23,040 KB |
testcase_25 | AC | 844 ms
23,296 KB |
testcase_26 | AC | 647 ms
23,424 KB |
testcase_27 | TLE | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
コンパイルメッセージ
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 lineCount = int.Parse(Reader.ReadLine()); int inputCount = int.Parse(Reader.ReadLine()); int[] dic = new int[lineCount]; List<int> numList = new List<int>(); int ans = lineCount; for (int i = 1; i <= lineCount; i++) { numList.Add(i-1); } List<AmidaLine> amidaList = new List<AmidaLine>(); for (int i = 0; i < inputCount; i++) { int[] inpt = Reader.GetInt(); AmidaLine al = new AmidaLine(inpt[0]-1, inpt[1]-1, i); amidaList.Add(al); } for (int i = 0; i < lineCount; i++) { int pos = -1; int idx = i; for (int j = 0; j < inputCount; j++) { List<AmidaLine> select = new List<AmidaLine>(amidaList.FindAll(a => (a.Line1 == idx || a.Line2 == idx) && a.Pos > pos).OrderBy(b => b.Pos)); if (select.Count == 0) { break; } pos = select[0].Pos; idx = select[0].Goto(idx); } dic[i] = idx; } int[] target = numList.ToArray(); int[] conv = new int[target.Length]; for (int i = 0; i < int.MaxValue; i++) { conv = new int[target.Length]; bool isMatch = true; for (int j = 0; j < target.Length; j++) { conv[dic[j]] = target[j]; if (isMatch && dic[j] != target[j]) { isMatch = false; } } target = conv; if (isMatch) { ans = i + 1; break; } } Console.WriteLine(ans); } public class AmidaLine { public int Line1; public int Line2; public int Pos; public int Goto(int from) { if (from == Line1) { return Line2; } return Line1; } public AmidaLine(int l1, int l2, int p) { this.Line2 = l2; this.Line1 = l1; this.Pos = p; } } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" "; 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(); } }