結果
| 問題 | No.555 世界史のレポート |
| コンテスト | |
| ユーザー |
Risen
|
| 提出日時 | 2017-08-11 23:54:57 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,220 bytes |
| 記録 | |
| コンパイル時間 | 1,785 ms |
| コンパイル使用メモリ | 114,024 KB |
| 実行使用メモリ | 34,524 KB |
| 最終ジャッジ日時 | 2024-10-12 22:15:00 |
| 合計ジャッジ時間 | 6,934 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 2 -- * 16 |
コンパイルメッセージ
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;
class Solution
{
internal struct State
{
internal int Cost;
internal int Length;
internal int CopiedLength;
internal State(int c, int l, int cl)
{
Cost = c;
Length = l;
CopiedLength = cl;
}
}
static void Main()
{
var n = int.Parse(Console.ReadLine());
var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
var c = vals[0];
var v = vals[1];
// cost -> length, copied length
var states = new List<State>() { { new State(0, 1, 0) } };
State best = states[0];
while (states.Count > 0)
{
var cur = states.OrderBy(s => s.Cost).First();
states.Remove(cur);
if (cur.Length >= n)
{
best = cur;
break;
}
// copy
states.Add(new State(cur.Cost + c, cur.Length, cur.Length));
// paste
states.Add(new State(cur.Cost + v, cur.Length + cur.CopiedLength, cur.CopiedLength));
}
Console.WriteLine(best.Cost);
}
}
Risen