結果

問題 No.182 新規性の虜
ユーザー 紙ぺーぱー紙ぺーぱー
提出日時 2015-04-07 23:18:24
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,749 bytes
コンパイル時間 2,941 ms
コンパイル使用メモリ 107,588 KB
実行使用メモリ 32,556 KB
最終ジャッジ日時 2023-09-17 15:59:50
合計ジャッジ時間 14,058 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
23,464 KB
testcase_01 AC 59 ms
19,380 KB
testcase_02 AC 59 ms
21,484 KB
testcase_03 AC 60 ms
21,520 KB
testcase_04 AC 59 ms
21,348 KB
testcase_05 AC 59 ms
21,424 KB
testcase_06 AC 59 ms
21,468 KB
testcase_07 AC 60 ms
21,412 KB
testcase_08 AC 3,553 ms
28,400 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
evil01.txt -- -
evil02.txt -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;

static public class Program
{
    static public void Main()
    {
        var n = readInteger().Validate(x => 1 <= x && x <= (int)1e5);
        var a = readInteger(n).ValidateArray(x => 1 <= x && x <= (int)1e9);
        var ok = new bool[n];
        for (int i = 0; i < n; i++)
            ok[i] = true;
        for (int i = 0; i < n; i++)
        {
            if (!ok[i])
                continue;
            for (int j = i + 1; j < n; j++)
            {
                if (a[i] == a[j])
                {
                    ok[i] = ok[j] = false;
                }
            }
        }
        Console.WriteLine(ok.Count(x => x));
    }

    static int readInteger()
    {
        var s = Console.ReadLine();
        return int.Parse(s);
    }
    static int[] readInteger(int n, params char[] sep)
    {
        var s = Console.ReadLine().Split(sep);
        if (s.Length != n)
            throw new Exception(string.Format("invalid input, expected{0} actual{1}", n, s.Length));
        var ret = new int[n];
        for (int i = 0; i < n; i++)
            ret[i] = int.Parse(s[i]);
        return ret;
    }
    static void readEOF()
    {
        if (Console.In.Peek() >= 0)
            throw new Exception("invalid input too long input file");
    }

}
static public class Ex
{
    static public T Validate<T>(this T input, Func<T, bool> f)
    {
        if (!f(input))
            throw new Exception("invalid input");
        return input;
    }
    static public T[] ValidateArray<T>(this T[] input, Func<T, bool> f)
    {
        foreach (var x in input)
            if (!f(x))
                throw new Exception("invalid input");
        return input;
    }
}


0