結果

問題 No.462 6日知らずのコンピュータ
ユーザー AreTrashAreTrash
提出日時 2016-12-13 05:57:22
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 2,592 bytes
コンパイル時間 1,174 ms
コンパイル使用メモリ 110,976 KB
実行使用メモリ 29,832 KB
最終ジャッジ日時 2024-05-07 09:09:15
合計ジャッジ時間 6,273 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
19,328 KB
testcase_01 AC 37 ms
19,456 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 39 ms
19,456 KB
testcase_07 RE -
testcase_08 WA -
testcase_09 AC 38 ms
19,968 KB
testcase_10 AC 37 ms
19,584 KB
testcase_11 AC 38 ms
19,712 KB
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 37 ms
20,096 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 39 ms
19,840 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
testcase_28 AC 38 ms
19,840 KB
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 AC 39 ms
19,584 KB
testcase_34 RE -
testcase_35 AC 38 ms
19,712 KB
testcase_36 RE -
testcase_37 WA -
testcase_38 AC 37 ms
19,584 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 39 ms
19,712 KB
testcase_45 AC 38 ms
19,584 KB
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 AC 38 ms
19,968 KB
testcase_50 RE -
testcase_51 AC 39 ms
19,584 KB
testcase_52 RE -
testcase_53 AC 38 ms
19,584 KB
testcase_54 AC 38 ms
19,712 KB
testcase_55 AC 38 ms
19,840 KB
testcase_56 RE -
testcase_57 RE -
testcase_58 AC 38 ms
19,584 KB
testcase_59 RE -
testcase_60 RE -
testcase_61 AC 38 ms
19,584 KB
testcase_62 AC 38 ms
19,456 KB
testcase_63 AC 39 ms
19,584 KB
testcase_64 AC 38 ms
19,456 KB
testcase_65 AC 39 ms
19,328 KB
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 AC 39 ms
19,840 KB
testcase_71 RE -
testcase_72 AC 37 ms
19,712 KB
testcase_73 AC 39 ms
19,968 KB
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 AC 38 ms
19,840 KB
testcase_80 WA -
testcase_81 AC 38 ms
19,712 KB
testcase_82 WA -
testcase_83 WA -
testcase_84 AC 38 ms
19,712 KB
testcase_85 AC 38 ms
19,712 KB
testcase_86 AC 37 ms
19,840 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.Linq;

namespace No462{
    public class Program{
        public static void Main(string[] args){
            var sr = new StreamReader();
            //---------------------------------
            var N = sr.Next<int>();
            var K = sr.Next<int>();
            var A = sr.Next<int>(K);

            const int mod = 1000000009;
            var mf = Ex.ModFac(100, mod);
            var a = A
                .Concat(new [] {0, (int)Math.Pow(2, N) - 1})
                .Select(x => Convert.ToString(x, 2).PadLeft(N, '0'))
                .OrderBy(x => x.Count(c => c == '1')).ToArray();

            var res = 1L;
            for(var i = 1; i < K + 2; i++){
                for(var j = 0; j < N; j++) if(a[i - 1][j] == '1' && a[i][j] == '0') res = 0L;
                res *= mf[a[i].Count(c => c == '1') - a[i - 1].Count(c => c == '1')];
                res %= mod;
            }

            Console.WriteLine(res);
            //---------------------------------
        }
    }

    public class Ex{
        public static long[] ModFac(int n, int mod){
            var ret = new long[n];
            ret[0] = 1;
            for(var i = 1; i < n; i++) ret[i] = ret[i - 1] * i % mod;
            return ret;
        }
    }

    public class StreamReader{
        private readonly char[] _c = {' '};
        private int _index = -1;
        private string[] _input = new string[0];
        private readonly System.IO.StreamReader _sr = new System.IO.StreamReader(Console.OpenStandardInput());

        public T Next<T>(){
            if(_index == _input.Length - 1){
                _index = -1;
                while(true){
                    string rl = _sr.ReadLine();
                    if(rl == null){
                        if(typeof(T).IsClass) return default(T);
                        return (T)typeof(T).GetField("MinValue").GetValue(null);
                    }
                    if(rl != ""){
                        _input = rl.Split(_c, StringSplitOptions.RemoveEmptyEntries);
                        break;
                    }
                }
            }
            return (T)Convert.ChangeType(_input[++_index], typeof(T), System.Globalization.CultureInfo.InvariantCulture);
        }

        public T[] Next<T>(int x){
            var ret = new T[x];
            for(var i = 0; i < x; ++i) ret[i] = Next<T>();
            return ret;
        }

        public T[][] Next<T>(int y, int x){
            var ret = new T[y][];
            for(var i = 0; i < y; ++i) ret[i] = Next<T>(x);
            return ret;
        }
    }
}
0