結果

問題 No.1109 調の判定
ユーザー bluemeganebluemegane
提出日時 2024-04-06 11:04:54
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 951 bytes
コンパイル時間 7,231 ms
コンパイル使用メモリ 157,752 KB
実行使用メモリ 178,312 KB
最終ジャッジ日時 2024-04-06 11:05:07
合計ジャッジ時間 12,060 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
31,652 KB
testcase_01 AC 62 ms
31,652 KB
testcase_02 AC 63 ms
31,652 KB
testcase_03 AC 62 ms
31,652 KB
testcase_04 AC 61 ms
31,652 KB
testcase_05 AC 61 ms
31,652 KB
testcase_06 AC 61 ms
31,652 KB
testcase_07 AC 62 ms
31,652 KB
testcase_08 AC 61 ms
31,652 KB
testcase_09 AC 61 ms
31,652 KB
testcase_10 AC 62 ms
31,652 KB
testcase_11 AC 63 ms
31,652 KB
testcase_12 AC 63 ms
31,652 KB
testcase_13 AC 63 ms
31,652 KB
testcase_14 AC 62 ms
31,652 KB
testcase_15 AC 62 ms
31,652 KB
testcase_16 AC 61 ms
31,652 KB
testcase_17 AC 62 ms
31,652 KB
testcase_18 AC 62 ms
31,652 KB
testcase_19 AC 62 ms
31,652 KB
testcase_20 AC 62 ms
31,652 KB
testcase_21 AC 62 ms
31,652 KB
testcase_22 AC 61 ms
31,652 KB
testcase_23 AC 61 ms
31,652 KB
testcase_24 AC 62 ms
31,652 KB
testcase_25 AC 61 ms
31,652 KB
testcase_26 AC 63 ms
31,652 KB
testcase_27 AC 62 ms
31,652 KB
testcase_28 AC 62 ms
31,652 KB
testcase_29 AC 62 ms
31,652 KB
testcase_30 AC 61 ms
31,652 KB
testcase_31 AC 63 ms
31,652 KB
testcase_32 AC 62 ms
31,652 KB
testcase_33 AC 62 ms
31,652 KB
testcase_34 AC 61 ms
31,652 KB
testcase_35 AC 62 ms
31,652 KB
testcase_36 AC 62 ms
31,652 KB
testcase_37 AC 62 ms
31,652 KB
testcase_38 AC 62 ms
31,652 KB
testcase_39 AC 61 ms
31,652 KB
testcase_40 AC 62 ms
31,652 KB
testcase_41 AC 61 ms
31,652 KB
testcase_42 AC 65 ms
31,652 KB
testcase_43 AC 61 ms
31,652 KB
testcase_44 AC 60 ms
31,652 KB
testcase_45 AC 62 ms
178,312 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (102 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System.Collections.Generic;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, a);
    }
    static void getAns(int n, int[] a)
    {
        var w = new int[] { 0, 2, 4, 5, 7, 9, 11 };
        var hs = new HashSet<int>[12];
        for (int i = 0; i < 12; i++)
        {
            hs[i] = new HashSet<int>();
            foreach (var x in w) hs[i].Add((x + i) % 12);
        }
        var c = new List<int>();
        for (int i = 0; i < 12; i++)
        {
            var ok = true;
            foreach (var x in a)
            {
                if (!hs[i].Contains(x)) { ok = false; break; }
            }
            if (ok) c.Add(i);
        }
        if (c.Count == 1) Console.WriteLine(c[0]);
        else Console.WriteLine(-1);
    }
}
0