結果
| 問題 | No.9 モンスターのレベル上げ |
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-03-30 14:55:24 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,905 bytes |
| コンパイル時間 | 3,750 ms |
| コンパイル使用メモリ | 115,868 KB |
| 実行使用メモリ | 32,680 KB |
| 最終ジャッジ日時 | 2024-10-02 08:09:46 |
| 合計ジャッジ時間 | 8,104 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 17 |
コンパイルメッセージ
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;
public class Program
{
public void Proc() {
Reader.IsDebug = false;
int cnt = int.Parse(Reader.ReadLine());
int[] inpt = Reader.GetInt();
for(int i=0; i<inpt.Length; i++) {
this.MikataList.Add(new Mikata(inpt[i]));
}
inpt = Reader.GetInt();
List<int> tekiOriginal = new List<int>();
tekiOriginal.AddRange(inpt);
int ans = int.MaxValue;
for(int i=0; i<inpt.Length; i++) {
int[] tekiArray = new int[tekiOriginal.Count];
tekiOriginal.CopyTo(i, tekiArray, 0, tekiOriginal.Count - i);
if(i > 0) {
tekiOriginal.CopyTo(0, tekiArray, tekiOriginal.Count - i, i);
}
int maxCount = 0;
for(int j=0; j<tekiArray.Length; j++) {
this.MikataList.Sort((a,b)=>{
if(a.Level < b.Level) {
return -1;
} else if(a.Level > b.Level)
{
return 1;
} else if(a.Count < b.Count)
{
return - 1;
} else if(a.Count > b.Count)
{
return 1;
}
return 0;
});
this.MikataList[0].Level += (tekiArray[j] / 2);
this.MikataList[0].Count++;
maxCount = Math.Max(maxCount, this.MikataList[0].Count);
}
ans = Math.Min(ans, maxCount);
}
Console.WriteLine(ans);
}
private List<Mikata> MikataList = new List<Mikata>();
public class Mikata {
public int Level = 0;
public int Count = 0;
public Mikata(int defaultLevel) {
this.Level = defaultLevel;
}
}
public class Reader {
private static String InitText = @"
5
6 1 5 9 2
7 7 9 4 4
";
private static System.IO.StringReader sr = null;
public static bool IsDebug = true;
public static string ReadLine() {
if(IsDebug) {
if(sr == null) {
sr = new System.IO.StringReader(InitText.Trim());
}
return sr.ReadLine();
} else {
return Console.ReadLine();
}
}
public static int[] GetInt(char delimiter = ' ') {
string[] inpt = ReadLine().Split(delimiter);
int[] ret = new int[inpt.Length];
for(int i=0; i<inpt.Length; i++) {
ret[i] = int.Parse(inpt[i]);
}
return ret;
}
}
public static void Main(string[] args)
{
Program prg = new Program();
prg.Proc();
}
}
14番