結果
問題 | No.45 回転寿司 |
ユーザー | 14番 |
提出日時 | 2016-03-27 20:45:21 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 70 ms / 5,000 ms |
コード長 | 1,697 bytes |
コンパイル時間 | 2,232 ms |
コンパイル使用メモリ | 104,424 KB |
実行使用メモリ | 23,072 KB |
最終ジャッジ日時 | 2023-08-27 14:38:37 |
合計ジャッジ時間 | 5,922 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 66 ms
20,844 KB |
testcase_01 | AC | 63 ms
20,892 KB |
testcase_02 | AC | 66 ms
22,908 KB |
testcase_03 | AC | 65 ms
20,924 KB |
testcase_04 | AC | 63 ms
18,828 KB |
testcase_05 | AC | 58 ms
20,876 KB |
testcase_06 | AC | 66 ms
22,944 KB |
testcase_07 | AC | 67 ms
23,072 KB |
testcase_08 | AC | 65 ms
20,904 KB |
testcase_09 | AC | 66 ms
22,896 KB |
testcase_10 | AC | 63 ms
20,884 KB |
testcase_11 | AC | 62 ms
18,884 KB |
testcase_12 | AC | 65 ms
20,840 KB |
testcase_13 | AC | 58 ms
22,828 KB |
testcase_14 | AC | 58 ms
22,732 KB |
testcase_15 | AC | 64 ms
20,840 KB |
testcase_16 | AC | 64 ms
20,768 KB |
testcase_17 | AC | 64 ms
20,828 KB |
testcase_18 | AC | 64 ms
22,876 KB |
testcase_19 | AC | 67 ms
20,912 KB |
testcase_20 | AC | 60 ms
22,812 KB |
testcase_21 | AC | 58 ms
22,672 KB |
testcase_22 | AC | 57 ms
20,768 KB |
testcase_23 | AC | 55 ms
20,728 KB |
testcase_24 | AC | 57 ms
20,672 KB |
testcase_25 | AC | 56 ms
20,764 KB |
testcase_26 | AC | 66 ms
20,960 KB |
testcase_27 | AC | 64 ms
20,824 KB |
testcase_28 | AC | 66 ms
20,876 KB |
testcase_29 | AC | 70 ms
22,968 KB |
testcase_30 | AC | 64 ms
22,960 KB |
testcase_31 | AC | 57 ms
20,768 KB |
testcase_32 | AC | 57 ms
20,768 KB |
testcase_33 | AC | 63 ms
20,860 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; public class Program { public void Proc(){ Reader.IsDebug = false; int susiCount = int.Parse(Reader.ReadLine()); this.SusiList.AddRange(Reader.GetInt()); int ans = this.GetAns(0); Console.WriteLine(ans); } private List<int> SusiList = new List<int>(); private Dictionary<int, int> dic = new Dictionary<int, int>(); private int GetAns(int idx) { if(dic.ContainsKey(idx)) { return dic[idx]; } if(idx >= SusiList.Count) { return 0; } int ans = 0; ans = Math.Max(ans, GetAns(idx + 2) + this.SusiList[idx]); ans = Math.Max(ans, this.GetAns(idx+1)); dic.Add(idx, ans); return ans; } public static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } } class Reader { public static bool IsDebug = true; private static System.IO.StringReader sr; public static string ReadLine() { if(IsDebug) { if(sr == null) { sr = new System.IO.StringReader(initStr.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ') { string[] inpt = ReadLine().Split(delimiter); int[] ret = new int[inpt.Length]; for(int i=0; i<inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } private static string initStr = @" 7 1 2 9 10 1 1 4 "; }