結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2016-04-18 03:19:04 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,750 bytes |
| コンパイル時間 | 3,168 ms |
| コンパイル使用メモリ | 114,424 KB |
| 実行使用メモリ | 33,548 KB |
| 最終ジャッジ日時 | 2024-06-11 06:47:10 |
| 合計ジャッジ時間 | 2,589 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 WA * 1 |
コンパイルメッセージ
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.Text;
using System.Linq;
class Program
{
public void Proc()
{
Reader.IsDebug = false;
int cnt = int.Parse(Reader.ReadLine());
int[] inpt = Reader.GetInt();
HashSet<int> tmp = new HashSet<int>(inpt);
List<int> sorted = new List<int>(tmp);
sorted.Sort();
int min = int.MaxValue;
for(int i=1; i<sorted.Count; i++) {
if(sorted[i] - sorted[i-1] < min) {
min = sorted[i] - sorted[i-1];
}
}
Console.WriteLine(min);
}
private double GetDeliverCost(int fromPos, int toPos, double nimotsu) {
int x1 = this.TargetList[fromPos].X;
int y1 = this.TargetList[fromPos].Y;
int x2 = this.TargetList[toPos].X;
int y2 = this.TargetList[toPos].Y;
double ans = GetMoveCost(x1, y1, x2, y2, nimotsu);
ans += this.TargetList[toPos].Nimotsu;
return ans;
}
private double GetMoveCost(int x1, int y1, int x2, int y2, double nimotsu) {
double ans = (Math.Abs(x1-x2) + Math.Abs(y1-y2)) * ((nimotsu + 100) / 120d);
return ans;
}
private List<Haitatsusaki> TargetList = new List<Haitatsusaki>();
public int StartX;
public int StartY;
public class Haitatsusaki {
public int X;
public int Y;
public double Nimotsu;
public Haitatsusaki(int x, int y, double nimotsu) {
this.X = x;
this.Y = y;
this.Nimotsu = nimotsu;
}
}
public class Reader
{
public static bool IsDebug = true;
private static String PlainInput = @"
4
0 1 1 0
";
private static System.IO.StringReader Sr = null;
public static string ReadLine()
{
if (IsDebug)
{
if (Sr == null)
{
Sr = new System.IO.StringReader(PlainInput.Trim());
}
return Sr.ReadLine();
}
else
{
return Console.ReadLine();
}
}
public static int[] GetInt(char delimiter = ' ', bool trim = false)
{
string inptStr = ReadLine();
if (trim)
{
inptStr = inptStr.Trim();
}
string[] inpt = inptStr.Split(delimiter);
int[] ret = new int[inpt.Length];
for (int i = 0; i < inpt.Length; i++)
{
ret[i] = int.Parse(inpt[i]);
}
return ret;
}
}
static void Main()
{
Program prg = new Program();
prg.Proc();
}
}
14番