結果
問題 |
No.2093 Shio Ramen
|
ユーザー |
|
提出日時 | 2022-10-07 21:32:35 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 952 bytes |
コンパイル時間 | 3,675 ms |
コンパイル使用メモリ | 112,188 KB |
実行使用メモリ | 55,024 KB |
最終ジャッジ日時 | 2024-06-12 06:19:15 |
合計ジャッジ時間 | 8,279 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 30 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray(); static void Main() { Solve(); } static void Solve() { var c = NList; var (n, x) = (c[0], c[1]); var map = NArr(n); var dp = new int[x + 1]; for (var i = 0; i < n; ++i) { for (var j = x; j >= 0; --j) { if (j > 0 && dp[j] == 0) continue; if (j + map[i][0] >= dp.Length) continue; dp[j + map[i][0]] = Math.Max(dp[j + map[i][0]], dp[j] + map[i][1]); } WriteLine(string.Join(" ", dp)); } WriteLine(dp.Max()); } }