結果
問題 | No.519 アイドルユニット |
ユーザー | 14番 |
提出日時 | 2017-05-28 22:31:37 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 126 ms / 1,000 ms |
コード長 | 2,191 bytes |
コンパイル時間 | 4,512 ms |
コンパイル使用メモリ | 108,204 KB |
実行使用メモリ | 27,172 KB |
最終ジャッジ日時 | 2023-07-26 16:54:32 |
合計ジャッジ時間 | 8,788 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 120 ms
25,088 KB |
testcase_01 | AC | 121 ms
25,224 KB |
testcase_02 | AC | 85 ms
23,000 KB |
testcase_03 | AC | 66 ms
21,780 KB |
testcase_04 | AC | 64 ms
21,752 KB |
testcase_05 | AC | 63 ms
21,616 KB |
testcase_06 | AC | 65 ms
23,688 KB |
testcase_07 | AC | 64 ms
21,652 KB |
testcase_08 | AC | 65 ms
21,696 KB |
testcase_09 | AC | 65 ms
21,772 KB |
testcase_10 | AC | 66 ms
23,804 KB |
testcase_11 | AC | 68 ms
23,800 KB |
testcase_12 | AC | 64 ms
21,700 KB |
testcase_13 | AC | 68 ms
19,736 KB |
testcase_14 | AC | 67 ms
21,736 KB |
testcase_15 | AC | 69 ms
21,808 KB |
testcase_16 | AC | 69 ms
21,640 KB |
testcase_17 | AC | 69 ms
21,708 KB |
testcase_18 | AC | 68 ms
21,892 KB |
testcase_19 | AC | 68 ms
21,908 KB |
testcase_20 | AC | 67 ms
21,804 KB |
testcase_21 | AC | 67 ms
19,616 KB |
testcase_22 | AC | 67 ms
21,636 KB |
testcase_23 | AC | 67 ms
21,724 KB |
testcase_24 | AC | 72 ms
22,020 KB |
testcase_25 | AC | 72 ms
19,964 KB |
testcase_26 | AC | 74 ms
22,048 KB |
testcase_27 | AC | 72 ms
20,044 KB |
testcase_28 | AC | 72 ms
22,080 KB |
testcase_29 | AC | 126 ms
25,120 KB |
testcase_30 | AC | 123 ms
27,172 KB |
testcase_31 | AC | 121 ms
23,056 KB |
testcase_32 | AC | 123 ms
25,088 KB |
testcase_33 | AC | 64 ms
21,772 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() { int IdolCount = int.Parse(Reader.ReadLine()); this.Aisho = new int[IdolCount, IdolCount]; for (int i = 0; i < IdolCount; i++) { int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray(); for (int j = 0; j < inpt.Length; j++) { this.Aisho[i, j] = inpt[j]; } } int ans = this.GetAns(0, 0); Console.WriteLine(ans); } private int GetAns(int idx, long flags) { long key = (long)1 << idx; if ((key & flags) > 0) { return GetAns(idx + 1, flags); } if (dic.ContainsKey(flags)) { return dic[flags]; } int ans = 0; for (int i = idx + 1; i < Aisho.GetLength(0); i++) { long pairKey = (long)1 << i; if ((flags & pairKey) > 0) { continue; } int ret = GetAns(idx + 1, flags + key + pairKey) + Aisho[idx, i]; ans = Math.Max(ret, ans); } dic[flags] = ans; return ans; } private Dictionary<long, int> dic = new Dictionary<long, int>(); private int[,] Aisho; public class Reader { public static bool IsDebug = false; private static String PlainInput = @" 6 -1 14 29 35 39 8 14 -1 35 41 34 3 29 35 -1 14 21 21 35 41 14 -1 12 42 39 34 21 12 -1 28 8 3 21 42 28 -1 "; 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() { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }