結果
問題 | No.323 yuki国 |
ユーザー | 14番 |
提出日時 | 2016-05-19 01:34:15 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,065 bytes |
コンパイル時間 | 874 ms |
コンパイル使用メモリ | 114,232 KB |
実行使用メモリ | 159,052 KB |
最終ジャッジ日時 | 2024-10-06 05:49:02 |
合計ジャッジ時間 | 39,645 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
27,340 KB |
testcase_01 | AC | 28 ms
25,508 KB |
testcase_02 | AC | 28 ms
27,548 KB |
testcase_03 | AC | 29 ms
25,776 KB |
testcase_04 | AC | 29 ms
25,504 KB |
testcase_05 | AC | 29 ms
25,300 KB |
testcase_06 | AC | 29 ms
25,428 KB |
testcase_07 | AC | 27 ms
25,168 KB |
testcase_08 | AC | 4,601 ms
156,020 KB |
testcase_09 | AC | 1,555 ms
89,576 KB |
testcase_10 | AC | 30 ms
27,552 KB |
testcase_11 | AC | 31 ms
25,428 KB |
testcase_12 | WA | - |
testcase_13 | AC | 1,439 ms
89,528 KB |
testcase_14 | AC | 4,854 ms
159,052 KB |
testcase_15 | AC | 1,246 ms
89,364 KB |
testcase_16 | AC | 3,302 ms
147,748 KB |
testcase_17 | AC | 1,494 ms
89,092 KB |
testcase_18 | AC | 45 ms
31,528 KB |
testcase_19 | AC | 1,251 ms
70,332 KB |
testcase_20 | AC | 65 ms
33,880 KB |
testcase_21 | AC | 3,742 ms
154,496 KB |
testcase_22 | AC | 421 ms
53,476 KB |
testcase_23 | AC | 4,961 ms
156,972 KB |
testcase_24 | AC | 148 ms
41,760 KB |
testcase_25 | AC | 1,399 ms
88,824 KB |
testcase_26 | AC | 144 ms
41,892 KB |
testcase_27 | AC | 3,597 ms
150,252 KB |
testcase_28 | AC | 1,480 ms
89,636 KB |
testcase_29 | AC | 1,488 ms
87,548 KB |
testcase_30 | AC | 30 ms
23,728 KB |
testcase_31 | AC | 30 ms
25,176 KB |
testcase_32 | AC | 32 ms
25,428 KB |
testcase_33 | AC | 32 ms
27,468 KB |
testcase_34 | AC | 29 ms
23,348 KB |
testcase_35 | AC | 28 ms
25,772 KB |
testcase_36 | AC | 30 ms
27,476 KB |
testcase_37 | AC | 29 ms
27,432 KB |
コンパイルメッセージ
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[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray(); this.Map = new Dictionary<int, int>[inpt[0], inpt[1]]; this.Src = new char[inpt[0], inpt[1]]; inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray(); int defaultSize = inpt[0]; int startY = inpt[1]; int startX = inpt[2]; inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray(); int goalSize = inpt[0]; int goalY = inpt[1]; int goalX = inpt[2]; int yukiCount = 0; int jimenCount = 0; for(int i=0; i<this.Map.GetLength(0); i++) { string str = Reader.ReadLine(); for(int j=0; j<str.Length; j++) { if(str[j] == '*') { yukiCount++; } else { jimenCount++; } this.Src[i,j] = str[j]; } } TaskItem firstTask = new TaskItem(startX, startY, defaultSize); Queue<TaskItem> taskQ = new Queue<TaskItem>(); taskQ.Enqueue(firstTask); while (taskQ.Count > 0) { TaskItem tsk = taskQ.Dequeue(); int size = tsk.Size; if(this.Map[tsk.Y, tsk.X] != null && this.Map[tsk.Y, tsk.X].ContainsKey(tsk.Size)) { continue; } if(this.Map[tsk.Y, tsk.X] == null) { this.Map[tsk.Y, tsk.X] = new Dictionary<int, int>(); } this.Map[tsk.Y, tsk.X].Add(size, 1); if(tsk.Y == goalY && tsk.X == goalX && size == goalSize) { break; } int[][] next = new int[4][]; next[0] = new int[]{tsk.Y - 1, tsk.X}; next[1] = new int[]{tsk.Y + 1, tsk.X}; next[2] = new int[]{tsk.Y, tsk.X + 1}; next[3] = new int[]{tsk.Y, tsk.X - 1}; for(int i=0; i<next.Length; i++) { int nextY = next[i][0]; int nextX = next[i][1]; if(nextY < 0 || nextY >= this.Map.GetLength(0) || nextX < 0 || nextX >= this.Map.GetLength(1)) { continue; } int newVal = (this.Src[nextY, nextX] == '*'?size+1:size-1); if(newVal <= 0) { continue; } if(newVal > this.Map.GetLength(0) * this.Map.GetLength(1) + goalSize) { continue; } TaskItem newT = new TaskItem(nextX, nextY, newVal); taskQ.Enqueue(newT); } } string ans = "No"; if(this.Map[goalY, goalX] != null && this.Map[goalY, goalX].ContainsKey(goalSize)) { ans = "Yes"; } Console.WriteLine(ans); } private Dictionary<int, int>[,] Map; private char[,] Src; private class TaskItem { public int X; public int Y; public int Size; public TaskItem(int x, int y, int size) { this.X = x; this.Y = y; this.Size = size; } } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 2 1 1 0 0 4 1 0 * * "; 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(); } } } static void Main() { Program prg = new Program(); prg.Proc(); } }