結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー | 14番 |
提出日時 | 2016-05-06 02:27:46 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 267 ms / 1,000 ms |
コード長 | 3,831 bytes |
コンパイル時間 | 2,448 ms |
コンパイル使用メモリ | 109,100 KB |
実行使用メモリ | 24,896 KB |
最終ジャッジ日時 | 2023-10-12 13:46:28 |
合計ジャッジ時間 | 6,575 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 262 ms
21,060 KB |
testcase_01 | AC | 267 ms
21,044 KB |
testcase_02 | AC | 265 ms
23,052 KB |
testcase_03 | AC | 263 ms
23,124 KB |
testcase_04 | AC | 62 ms
23,976 KB |
testcase_05 | AC | 62 ms
21,924 KB |
testcase_06 | AC | 62 ms
23,892 KB |
testcase_07 | AC | 63 ms
21,956 KB |
testcase_08 | AC | 206 ms
24,896 KB |
testcase_09 | AC | 62 ms
21,948 KB |
testcase_10 | AC | 64 ms
21,824 KB |
testcase_11 | AC | 64 ms
21,888 KB |
testcase_12 | AC | 63 ms
21,828 KB |
testcase_13 | AC | 63 ms
21,708 KB |
testcase_14 | AC | 64 ms
23,816 KB |
testcase_15 | AC | 62 ms
21,896 KB |
testcase_16 | AC | 63 ms
23,948 KB |
testcase_17 | AC | 63 ms
21,896 KB |
testcase_18 | AC | 66 ms
23,748 KB |
testcase_19 | AC | 63 ms
21,772 KB |
testcase_20 | AC | 63 ms
21,744 KB |
testcase_21 | AC | 63 ms
23,980 KB |
testcase_22 | AC | 63 ms
21,836 KB |
testcase_23 | AC | 62 ms
21,848 KB |
testcase_24 | AC | 64 ms
23,880 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(' ').ToList().Select(a => int.Parse(a)).ToArray(); int goalTurn = inpt[0]; int up = inpt[1]; int right = inpt[2]; if (goalTurn < Math.Max(up, right)) { Console.WriteLine("NO"); return; } List<String> moveList = new List<string>(); if (up > 0 && right > 0) { for (int i = 0; i < Math.Min(up, right); i++) { moveList.Add("^>"); } } if (up > right) { for (int i = 0; i < up - right; i++) { moveList.Add("^"); } } if (right > up) { for (int i = 0; i < right - up; i++) { moveList.Add(">"); } } if (goalTurn > moveList.Count) { while (goalTurn - moveList.Count >= 2) { int addCount = (goalTurn - moveList.Count) / 2; if (moveList.Contains(">")) { for (int i = 0; i < addCount; i++) { moveList.Add(">"); moveList.Add("<"); } } else { for (int i = 0; i < addCount; i++) { moveList.Add("^"); moveList.Add("v"); } } } } if (goalTurn > moveList.Count) { if (moveList.Contains("^>")) { int idx = moveList.IndexOf("^>"); moveList.RemoveAt(idx); moveList.Add("^"); moveList.Add(">"); } else if (moveList.Contains("^")) { int idx = moveList.IndexOf("^"); moveList.RemoveAt(idx); moveList.Add("^>"); moveList.Add("<"); } else if (moveList.Contains(">")) { int idx = moveList.IndexOf(">"); moveList.RemoveAt(idx); moveList.Add("^>"); moveList.Add("v"); } else { Console.WriteLine("NO"); return; } } Console.WriteLine("YES"); moveList.ForEach(a => Console.WriteLine(a)); } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 100000 0 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(); } } 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(); } }