結果

問題 No.710 チーム戦
ユーザー Tomohiko Hasegawa
提出日時 2019-03-30 15:37:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 118 ms / 3,000 ms
コード長 2,163 bytes
コンパイル時間 1,007 ms
コンパイル使用メモリ 111,888 KB
実行使用メモリ 35,664 KB
最終ジャッジ日時 2024-11-15 16:57:50
合計ジャッジ時間 4,526 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
プレゼンテーションモードにする

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;
namespace AtTest.DP
{
class yuki710
{
static void Main(string[] args)
{
Method(args);
ReadLine();
}
static void Method(string[] args)
{
int n = ReadInt();
int[][] abs = new int[n][];
for(int i = 0; i < n; i++)
{
abs[i] = ReadInts();
}
int length = 100000 + 1000;
int inf = int.MaxValue / 4;
int[] dp = new int[length];
for (int i = 0; i < length; i++) dp[i] = inf;
dp[0] = 0;
for (int i = 0; i < n; i++)
{
int[] next = new int[length];
for (int j = 0; j < length; j++) next[j] = inf;
for (int j = 0; j < length; j++)
{
if (dp[j] == inf) continue;
next[j] = Min(next[j], dp[j] + abs[i][1]);
int nextIndex = j + abs[i][0];
if (nextIndex < length)
{
next[nextIndex] = Min(next[nextIndex], dp[j]);
}
}
dp = next;
}
int min = int.MaxValue;
for(int i = 0; i < length; i++)
{
min = Min(min, Max(i, dp[i]));
//if (i <= 10) WriteLine(dp[i]);
}
WriteLine(min);
}
private static string Read() { return ReadLine(); }
private static int ReadInt() { return int.Parse(Read()); }
private static long ReadLong() { return long.Parse(Read()); }
private static double ReadDouble() { return double.Parse(Read()); }
private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0