結果

問題 No.462 6日知らずのコンピュータ
ユーザー AreTrashAreTrash
提出日時 2016-12-13 06:29:09
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,829 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 116,040 KB
実行使用メモリ 27,836 KB
最終ジャッジ日時 2024-05-07 09:11:24
合計ジャッジ時間 5,913 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

            const long mod = 1000000007;
            var mf = Ex.ModFac(100, mod);
            var a = A
                .Concat(new[]{0, Ex.ModPow(2, N, mod) - 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(long n, long 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 static long ModPow(long x, long pow, long mod){
            var ret = 1L;
            for(var i = 0; i < pow; i++){
                ret *= x;
                ret %= 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