結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー | 14番 |
提出日時 | 2016-05-03 17:09:32 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,290 bytes |
コンパイル時間 | 1,301 ms |
コンパイル使用メモリ | 109,824 KB |
実行使用メモリ | 20,312 KB |
最終ジャッジ日時 | 2024-10-13 14:01:35 |
合計ジャッジ時間 | 4,358 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 30 ms
19,072 KB |
testcase_05 | AC | 30 ms
18,816 KB |
testcase_06 | AC | 30 ms
18,944 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 31 ms
18,816 KB |
testcase_30 | AC | 31 ms
18,816 KB |
testcase_31 | AC | 31 ms
19,200 KB |
testcase_32 | AC | 30 ms
18,816 KB |
testcase_33 | AC | 30 ms
18,944 KB |
testcase_34 | AC | 31 ms
19,072 KB |
testcase_35 | AC | 31 ms
19,200 KB |
testcase_36 | AC | 30 ms
18,944 KB |
testcase_37 | AC | 30 ms
19,072 KB |
testcase_38 | AC | 31 ms
19,072 KB |
testcase_39 | AC | 29 ms
18,816 KB |
testcase_40 | AC | 30 ms
18,944 KB |
testcase_41 | WA | - |
testcase_42 | AC | 31 ms
18,944 KB |
testcase_43 | AC | 30 ms
18,816 KB |
testcase_44 | AC | 29 ms
18,944 KB |
testcase_45 | AC | 31 ms
18,944 KB |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
コンパイルメッセージ
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 yukyuCount = int.Parse(Reader.ReadLine()); StringBuilder sb = new StringBuilder(); sb.Append(Reader.ReadLine()); sb.Append(Reader.ReadLine()); this.input = sb.ToString(); List<string> kumiawase = this.GetKumiawase(0, yukyuCount); int ans = 0; kumiawase.ForEach((a)=>{ string[] tmp = a.Split('x'); ans = Math.Max(ans, tmp.Max(b=>b.Length)); }); Console.WriteLine(ans); } string input = string.Empty; private Dictionary<int, Dictionary<int, List<String>>> dic = new Dictionary<int, Dictionary<int, List<String>>>(); private List<string> GetKumiawase(int idx, int remainYukyu) { if(!dic.ContainsKey(idx)) { dic.Add(idx, new Dictionary<int, List<string>>()); } if(dic[idx].ContainsKey(remainYukyu)) { return dic[idx][remainYukyu]; } List<string> ans = new List<string>(); if(idx == input.Length - 1) { if(remainYukyu == 0) { ans.Add(this.input[idx].ToString()); } else { if(input[idx] == 'o') { ans.Add("o".PadLeft(remainYukyu + 1, 'o')); } else { ans.Add("o".PadLeft(remainYukyu, 'o')); } } } else { if(this.input[idx] == 'o') { List<string> tmp = this.GetKumiawase(idx+1, remainYukyu); tmp.ForEach(a=>ans.Add("o" + a)); } else { List <string> tmp = this.GetKumiawase(idx+1, remainYukyu); tmp.ForEach(a=>ans.Add("x" + a)); if(remainYukyu > 0) { tmp = this.GetKumiawase(idx+1, remainYukyu - 1); tmp.ForEach(a=>ans.Add("o" + a)); } } } this.dic[idx].Add(remainYukyu, ans); return ans; } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 1 oxxxxxo xoxxxxo "; 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(); } }