結果
問題 | No.45 回転寿司 |
ユーザー | hogeki |
提出日時 | 2016-08-01 23:03:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,476 bytes |
コンパイル時間 | 794 ms |
コンパイル使用メモリ | 109,380 KB |
実行使用メモリ | 101,900 KB |
最終ジャッジ日時 | 2024-05-03 15:31:30 |
合計ジャッジ時間 | 10,862 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 49 ms
35,684 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 112 ms
42,588 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 90 ms
40,932 KB |
testcase_12 | WA | - |
testcase_13 | AC | 46 ms
33,628 KB |
testcase_14 | AC | 41 ms
35,680 KB |
testcase_15 | WA | - |
testcase_16 | AC | 132 ms
48,980 KB |
testcase_17 | WA | - |
testcase_18 | AC | 130 ms
46,932 KB |
testcase_19 | WA | - |
testcase_20 | AC | 44 ms
33,636 KB |
testcase_21 | AC | 49 ms
33,904 KB |
testcase_22 | AC | 29 ms
23,868 KB |
testcase_23 | AC | 28 ms
26,148 KB |
testcase_24 | AC | 28 ms
24,384 KB |
testcase_25 | AC | 25 ms
26,164 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 28 ms
26,164 KB |
testcase_32 | AC | 28 ms
26,168 KB |
testcase_33 | 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; namespace KaitenZushi { class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int[] V = new int[N]; string[] vals = Console.ReadLine().Split(' '); for(int i=0; i < N; i++) { V[i] = int.Parse(vals[i]); } List<int>[] dp = new List<int>[100101]; for(int i=0; i <= 100100; i++) { dp[i] = new List<int>(); } int maxValue = 0; for(int i=0; i < N; i++) { for(int v=10000; v >= 1; v--) { if(CheckList(dp[v], i)) { int val = v + V[i]; dp[val].Add(i); if (maxValue < val) maxValue = val; } } dp[V[i]].Add(i); if (maxValue < V[i]) maxValue = V[i]; } Console.WriteLine(maxValue); } static bool CheckList(List<int> list, int i) { if (list.Count == 0) return false; foreach(int j in list) { if (j != i - 1) return true; } return false; } } }