結果

問題 No.462 6日知らずのコンピュータ
ユーザー AreTrashAreTrash
提出日時 2016-12-13 06:39:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,590 bytes
コンパイル時間 1,107 ms
コンパイル使用メモリ 109,952 KB
実行使用メモリ 19,840 KB
最終ジャッジ日時 2024-05-07 09:12:23
合計ジャッジ時間 5,978 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
19,456 KB
testcase_01 AC 29 ms
19,328 KB
testcase_02 AC 32 ms
19,584 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 30 ms
19,456 KB
testcase_50 AC 31 ms
19,456 KB
testcase_51 AC 32 ms
19,584 KB
testcase_52 AC 31 ms
19,584 KB
testcase_53 AC 31 ms
19,712 KB
testcase_54 AC 31 ms
19,584 KB
testcase_55 AC 30 ms
19,456 KB
testcase_56 AC 32 ms
19,456 KB
testcase_57 AC 32 ms
19,712 KB
testcase_58 AC 34 ms
19,712 KB
testcase_59 AC 30 ms
19,584 KB
testcase_60 AC 32 ms
19,712 KB
testcase_61 AC 31 ms
19,712 KB
testcase_62 WA -
testcase_63 AC 32 ms
19,456 KB
testcase_64 AC 31 ms
19,456 KB
testcase_65 AC 32 ms
19,456 KB
testcase_66 AC 35 ms
19,712 KB
testcase_67 AC 34 ms
19,712 KB
testcase_68 AC 32 ms
19,840 KB
testcase_69 AC 33 ms
19,712 KB
testcase_70 AC 33 ms
19,584 KB
testcase_71 AC 33 ms
19,456 KB
testcase_72 AC 31 ms
19,456 KB
testcase_73 AC 32 ms
19,840 KB
testcase_74 AC 32 ms
19,712 KB
testcase_75 AC 33 ms
19,584 KB
testcase_76 AC 31 ms
19,328 KB
testcase_77 AC 32 ms
19,584 KB
testcase_78 AC 31 ms
19,584 KB
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 AC 31 ms
19,584 KB
testcase_86 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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_1{
    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<long>(K);

            const int mod = 1000000007;
            var mf = Ex.ModFac(100, mod);
            var a = A
                .Concat(new[]{0, (long)Math.Pow(2, N)})
                .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