結果

問題 No.462 6日知らずのコンピュータ
ユーザー mbanmban
提出日時 2016-12-22 13:25:55
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,256 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 114,672 KB
実行使用メモリ 29,212 KB
最終ジャッジ日時 2024-05-08 11:00:12
合計ジャッジ時間 5,884 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
25,636 KB
testcase_01 AC 31 ms
23,352 KB
testcase_02 AC 32 ms
27,560 KB
testcase_03 AC 32 ms
26,992 KB
testcase_04 AC 32 ms
25,484 KB
testcase_05 AC 32 ms
25,228 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 26 ms
24,976 KB
testcase_09 AC 31 ms
25,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 31 ms
25,484 KB
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 AC 31 ms
25,232 KB
testcase_23 AC 32 ms
25,388 KB
testcase_24 AC 32 ms
25,228 KB
testcase_25 AC 32 ms
25,132 KB
testcase_26 AC 32 ms
25,232 KB
testcase_27 WA -
testcase_28 AC 32 ms
27,172 KB
testcase_29 AC 32 ms
27,268 KB
testcase_30 AC 31 ms
25,252 KB
testcase_31 AC 31 ms
25,228 KB
testcase_32 WA -
testcase_33 AC 32 ms
27,140 KB
testcase_34 WA -
testcase_35 AC 32 ms
25,484 KB
testcase_36 AC 33 ms
25,352 KB
testcase_37 WA -
testcase_38 AC 32 ms
25,228 KB
testcase_39 WA -
testcase_40 AC 34 ms
27,144 KB
testcase_41 AC 31 ms
25,248 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 32 ms
25,484 KB
testcase_45 AC 32 ms
25,100 KB
testcase_46 AC 33 ms
25,356 KB
testcase_47 AC 32 ms
25,380 KB
testcase_48 WA -
testcase_49 AC 33 ms
27,300 KB
testcase_50 AC 32 ms
27,268 KB
testcase_51 AC 32 ms
25,264 KB
testcase_52 AC 32 ms
25,484 KB
testcase_53 AC 32 ms
27,312 KB
testcase_54 AC 31 ms
25,488 KB
testcase_55 AC 32 ms
25,232 KB
testcase_56 AC 32 ms
25,360 KB
testcase_57 AC 32 ms
25,232 KB
testcase_58 AC 32 ms
27,148 KB
testcase_59 AC 32 ms
25,360 KB
testcase_60 AC 32 ms
25,256 KB
testcase_61 AC 32 ms
27,312 KB
testcase_62 WA -
testcase_63 AC 33 ms
23,348 KB
testcase_64 AC 34 ms
27,304 KB
testcase_65 AC 32 ms
27,276 KB
testcase_66 AC 32 ms
25,360 KB
testcase_67 AC 32 ms
27,268 KB
testcase_68 AC 32 ms
25,484 KB
testcase_69 AC 32 ms
27,184 KB
testcase_70 AC 32 ms
27,392 KB
testcase_71 AC 33 ms
25,264 KB
testcase_72 AC 31 ms
23,476 KB
testcase_73 AC 33 ms
27,264 KB
testcase_74 AC 32 ms
25,336 KB
testcase_75 AC 32 ms
25,520 KB
testcase_76 AC 33 ms
27,296 KB
testcase_77 AC 32 ms
25,512 KB
testcase_78 AC 32 ms
25,356 KB
testcase_79 AC 27 ms
26,628 KB
testcase_80 AC 27 ms
24,588 KB
testcase_81 AC 27 ms
25,012 KB
testcase_82 AC 27 ms
22,968 KB
testcase_83 AC 27 ms
24,844 KB
testcase_84 AC 33 ms
25,228 KB
testcase_85 AC 33 ms
25,232 KB
testcase_86 AC 28 ms
24,716 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.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;

class Magatro
{
    static int N, K;
   const long MOD = 1000000007;
    static void Main()
    {
  
        string[] s = Console.ReadLine().Split(' ');
        N = int.Parse(s[0]);
        K = int.Parse(s[1]);
        if (K == 0)
        {
            Console.WriteLine(kaijou(N));
            return;
        }
        long[] a = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        Array.Sort(a);
        long b = 0;
        long result = 1;
        for(int i = 0; i < K; i++)
        {
            if (!check(b, a[i]))
            {
                Console.WriteLine(0);
                return;
            }
         //   Console.WriteLine(count(b, a[i]));
          result*=  count(b, a[i]);
            result %= MOD;
            b = a[i];
        }

        result *= count(b, MyPow(2, N));
        Console.WriteLine(result % MOD);


    }

    static long count(long a,long b)
    {
        int cnt = 0;
        for(int i = 0; i < N; i++)
        {
            if (a % 2 <b %2)
            {
                cnt++;
            }
            a /= 2;
            b /= 2;
        }
     //   Console.WriteLine(cnt);
        return kaijou(cnt);
    }
    static bool check(long a,long b)
    {
        
        for (int i = 0; i < N; i++)
        {
            if (a % 2> b % 2)
            {
               
                return false;
            }
            a /= 2;
            b /= 2;
        }
        //Console.WriteLine("a");
        return true;
    }
    static long MyPow(long a,long b)
    {
        long result = 1;
        while (b > 0)
        {
            if (b % 2 == 0)
            {
                a *= a;
           //     a %= MOD;
                b /= 2;
            }
            else
            {
                result *= a;
          //      result %= MOD;
                b--;
            }

        }
        return result;
    }
    static long kaijou(long n)
    {
        if (n == 0)
        {
            return 1;
        }
        else
        {
            return n * kaijou(n - 1) % MOD;
        }
    }
}
0