結果

問題 No.9005 実行時間/使用メモリテスト(テスト用)
ユーザー eitahoeitaho
提出日時 2016-02-19 18:11:17
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 2,919 bytes
コンパイル時間 2,321 ms
コンパイル使用メモリ 117,136 KB
実行使用メモリ 29,096 KB
最終ジャッジ日時 2023-10-23 18:32:08
合計ジャッジ時間 16,568 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,942 ms
24,888 KB
testcase_01 AC 2,111 ms
24,888 KB
testcase_02 TLE -
testcase_03 AC 2,955 ms
24,904 KB
testcase_04 AC 1,935 ms
24,888 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using System.Numerics;
using Enu = System.Linq.Enumerable;

class Program
{
    static readonly int N = (int)1e8;

    public void Solve()
    {
        int type = Reader.Int();
        var random = new Random(0);
        int ans = int.MaxValue;

        for (int i = 0; i < N; i++)
        {
            int val = random.Next();
            switch (type)
            {
                case 1: CheckMin1(ref ans, val); break;
                case 2: CheckMin2(ref ans, val); break;
                case 3: CheckMin3(ref ans, val); break;
                case 4: CheckMin4(ref ans, val); break;
                case 5: ans = Math.Min(ans, val); break;
            }
        }

        Console.WriteLine(0);
    }

    static void CheckMin1(ref int a, int b) { if (b < a) a = b; }

    static void CheckMin2(ref int a, int b) { if (b.CompareTo(a) < 0) a = b; }

    static void CheckMin3<T>(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) a = b; }

    static void CheckMin4<T>(ref T a, T b) { if (Comparer<T>.Default.Compare(b, a) < 0) a = b; }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    private static TextReader reader = Console.In;
    private static readonly char[] separator = { ' ' };
    private static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    private static string[] A = new string[0];
    private static int i;
    private static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Enu.Range(0, N).Select(i => Int()).ToArray(); }
    public static int[][] IntTable(int H) { return Enu.Range(0, H).Select(i => IntLine()).ToArray(); }
    public static string[] StringArray(int N) { return Enu.Range(0, N).Select(i => Next()).ToArray(); }
    public static string Line() { return reader.ReadLine().Trim(); }
    private static string[] Split(string s) { return s.Split(separator, op); }
    private static string Next() { CheckNext(); return A[i++]; }
    private static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}
0