結果
問題 | No.145 yukiover |
ユーザー | 14番 |
提出日時 | 2016-07-20 07:35:36 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,474 bytes |
コンパイル時間 | 1,275 ms |
コンパイル使用メモリ | 114,436 KB |
実行使用メモリ | 31,664 KB |
最終ジャッジ日時 | 2024-10-15 17:29:51 |
合計ジャッジ時間 | 3,918 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 27 ms
18,944 KB |
testcase_01 | AC | 24 ms
19,072 KB |
testcase_02 | AC | 24 ms
19,072 KB |
testcase_03 | AC | 31 ms
19,200 KB |
testcase_04 | AC | 25 ms
19,072 KB |
testcase_05 | AC | 29 ms
18,944 KB |
testcase_06 | AC | 32 ms
19,200 KB |
testcase_07 | AC | 33 ms
19,200 KB |
testcase_08 | WA | - |
testcase_09 | AC | 25 ms
19,072 KB |
testcase_10 | WA | - |
testcase_11 | AC | 32 ms
19,584 KB |
testcase_12 | AC | 44 ms
20,736 KB |
testcase_13 | AC | 50 ms
20,608 KB |
testcase_14 | AC | 54 ms
20,608 KB |
testcase_15 | WA | - |
testcase_16 | AC | 30 ms
19,200 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 52 ms
21,632 KB |
testcase_20 | AC | 53 ms
21,504 KB |
testcase_21 | WA | - |
testcase_22 | AC | 52 ms
21,504 KB |
testcase_23 | AC | 44 ms
20,096 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 panelCount = int.Parse(Reader.ReadLine()); string inpt = Reader.ReadLine(); char[] big = inpt.Where(a=>a>'y').ToArray(); char[] nokori = inpt.Where(a=>a<='y').ToArray(); int ans = this.getAns(nokori) + big.Length; Console.WriteLine(ans); } private int getAns(char[] nokori) { int ans = 0; char[] y = nokori.Where(a=>a == 'y').ToArray(); char[] other = nokori.Where(a=>a!='y').ToArray(); if(other.Count(a=>a > 'u') > 0) { char[] uOver = other.Where(a=>a>'u').OrderBy(a=>a).ToArray(); other = other.Where(a=>a<='u').ToArray(); if(uOver.Length >= y.Length) { return y.Length; } else { ans = uOver.Length; y = y.Skip(uOver.Length).ToArray(); } } if(y.Length == 0) { return ans; } if(other.Count(a=>a=='u') > 0) { char[] u = other.Where(a=>a=='u').ToArray(); other = other.Where(a=>a!='u').ToArray(); if(u.Length > y.Length) { u = u.Skip(y.Length).ToArray(); other = other.Concat(u).ToArray(); } else if(u.Length < y.Length) { other = other.Concat(y.Skip(u.Length)).ToArray(); y = y.Take(u.Length).ToArray(); } } else { y = new char[0]; } if(y.Length == 0) { return ans; } if(other.Count(a=>a>'k') > 0) { char[] kOver = other.Where(a=>a>'k').OrderBy(a=>a).ToArray(); other = other.Where(a=>a <= 'k').ToArray(); if(kOver.Length >= y.Length) { ans += y.Length; return ans; } else { ans += kOver.Length; y = y.Skip(kOver.Length).ToArray(); } } if(other.Count(a=>a=='k') > 0) { char[] k = other.Where(a=>a=='k').ToArray(); other = other.Where(a=>a!='k').ToArray(); if(k.Length > y.Length) { k = k.Skip(y.Length).ToArray(); other = other.Concat(k).ToArray(); } else if(k.Length < y.Length) { other = other.Concat(y.Skip(k.Length)).ToArray(); y = y.Take(k.Length).ToArray(); } } else { y = new char[0]; } if(y.Length == 0) { return ans; } if(other.Count(a=>a>'i') > 0) { char[] iOver = other.Where(a=>a>'i').OrderBy(a=>a).ToArray(); other = other.Where(a=>a<='i').ToArray(); if(iOver.Length < y.Length) { ans+=iOver.Length; y = y.Skip(iOver.Length).ToArray(); } else { ans+=y.Length; return ans; } } if(other.Count(a=>a=='i') > 0) { char[] i = other.Where(a=>a=='i').ToArray(); other = other.Where(a=>a != 'i').ToArray(); if(i.Length > y.Length) { i = i.Skip(y.Length).ToArray(); other = other.Concat(i).ToArray(); } else if(i.Length < y.Length) { other = other.Concat(y.Skip(i.Length)).ToArray(); y = y.Take(i.Length).ToArray(); } } else { y = new char[0]; } if(y.Length == 0) { return ans; } if(other.Length > y.Length) { ans += y.Length; } else { ans += other.Length; } return ans; } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 11 kyuukyuusya "; 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(); } }