結果
問題 |
No.54 Happy Hallowe'en
|
ユーザー |
|
提出日時 | 2014-11-07 08:40:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 2,187 ms / 5,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 1,325 ms |
コンパイル使用メモリ | 112,520 KB |
実行使用メモリ | 23,424 KB |
最終ジャッジ日時 | 2024-10-15 17:10:49 |
合計ジャッジ時間 | 13,572 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 |
コンパイルメッセージ
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.Linq; namespace Yukicoder { class Program { public static void Main(string[] args) { var m = new Dictionary<int,int>(); var n = int.Parse(Console.ReadLine()); m[0]=1; Enumerable.Range(1,n).Select(_ => Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToList()).ToList().OrderBy(x => x[0]+x[1]).ToList().ForEach( x =>{ for(int i=x[1]-1;i>=0;i--){ if(m.ContainsKey(i))m[i+x[0]]=1; } }); Console.WriteLine("{0}",m.Keys.Max()); } } }