結果
| 問題 |
No.472 平均順位
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-07-17 23:33:23 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,591 bytes |
| コンパイル時間 | 3,508 ms |
| コンパイル使用メモリ | 115,544 KB |
| 実行使用メモリ | 49,604 KB |
| 最終ジャッジ日時 | 2024-10-08 07:25:57 |
| 合計ジャッジ時間 | 8,245 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 RE * 1 |
| other | AC * 6 RE * 5 TLE * 3 -- * 2 |
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
using System.IO;
class Program
{
static void Main()
{
new Magatro().Solve();
}
}
class Magatro
{
private int N, P;
private int[] A, B, C;
private void Scan()
{
var line = Console.ReadLine().Split(' ');
N = int.Parse(line[0]);
P = int.Parse(line[1]);
A = new int[N];
B = new int[N];
C = new int[N];
for (int i = 0; i < N; i++)
{
line = Console.ReadLine().Split(' ');
A[i] = int.Parse(line[0]);
B[i] = int.Parse(line[1]);
C[i] = int.Parse(line[2]);
}
}
public void Solve()
{
Scan();
var dp = (new int[3 * P + 1]).Select(i => int.MaxValue).ToArray();
dp[0] = 0;
for (int i = 0; i < N; i++)
{
var next = (new int[3 * P + 1]).Select(ii => int.MaxValue).ToArray();
for (int j = 3 * P; j >= 0; j--)
{
if (dp[j] != int.MaxValue)
{
next[j + 0] = Math.Min(next[j + 0], dp[j] + A[i]);
next[j + 1] = Math.Min(next[j + 1], dp[j] + B[i]);
next[j + 2] = Math.Min(next[j + 2], dp[j] + C[i]);
next[j + 3] = Math.Min(next[j + 3], dp[j] + 1);
}
}
dp = next;
}
Console.WriteLine((double)dp[P] / N);
}
}
mban