結果

問題 No.462 6日知らずのコンピュータ
ユーザー fiordfiord
提出日時 2017-02-28 15:48:34
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,134 bytes
コンパイル時間 2,030 ms
コンパイル使用メモリ 105,008 KB
実行使用メモリ 24,860 KB
最終ジャッジ日時 2023-09-02 16:58:34
合計ジャッジ時間 9,777 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,896 KB
testcase_01 AC 56 ms
22,776 KB
testcase_02 AC 57 ms
20,760 KB
testcase_03 AC 56 ms
22,712 KB
testcase_04 AC 59 ms
20,812 KB
testcase_05 AC 60 ms
22,800 KB
testcase_06 AC 59 ms
20,744 KB
testcase_07 AC 59 ms
20,848 KB
testcase_08 AC 56 ms
20,748 KB
testcase_09 AC 58 ms
20,812 KB
testcase_10 AC 59 ms
22,808 KB
testcase_11 AC 57 ms
18,888 KB
testcase_12 AC 59 ms
20,920 KB
testcase_13 AC 58 ms
22,784 KB
testcase_14 AC 59 ms
20,840 KB
testcase_15 AC 57 ms
20,760 KB
testcase_16 AC 58 ms
20,760 KB
testcase_17 AC 60 ms
20,684 KB
testcase_18 AC 59 ms
20,832 KB
testcase_19 AC 58 ms
20,836 KB
testcase_20 AC 60 ms
20,904 KB
testcase_21 AC 59 ms
22,928 KB
testcase_22 AC 57 ms
20,836 KB
testcase_23 AC 61 ms
22,780 KB
testcase_24 AC 60 ms
20,708 KB
testcase_25 AC 60 ms
18,756 KB
testcase_26 AC 59 ms
20,756 KB
testcase_27 AC 58 ms
22,856 KB
testcase_28 AC 57 ms
20,672 KB
testcase_29 AC 57 ms
20,748 KB
testcase_30 AC 59 ms
22,716 KB
testcase_31 AC 60 ms
20,724 KB
testcase_32 AC 56 ms
20,884 KB
testcase_33 AC 59 ms
22,776 KB
testcase_34 AC 59 ms
20,808 KB
testcase_35 AC 57 ms
20,792 KB
testcase_36 AC 59 ms
20,904 KB
testcase_37 AC 61 ms
22,848 KB
testcase_38 AC 60 ms
20,916 KB
testcase_39 AC 61 ms
20,928 KB
testcase_40 AC 60 ms
20,760 KB
testcase_41 AC 62 ms
20,804 KB
testcase_42 AC 60 ms
20,796 KB
testcase_43 AC 61 ms
20,804 KB
testcase_44 AC 59 ms
22,916 KB
testcase_45 AC 59 ms
22,848 KB
testcase_46 AC 58 ms
20,804 KB
testcase_47 AC 58 ms
20,812 KB
testcase_48 AC 58 ms
20,664 KB
testcase_49 AC 58 ms
22,712 KB
testcase_50 AC 60 ms
20,928 KB
testcase_51 AC 58 ms
18,748 KB
testcase_52 AC 59 ms
22,852 KB
testcase_53 AC 59 ms
20,800 KB
testcase_54 AC 60 ms
22,852 KB
testcase_55 AC 60 ms
20,760 KB
testcase_56 AC 60 ms
18,724 KB
testcase_57 AC 61 ms
22,800 KB
testcase_58 AC 60 ms
20,904 KB
testcase_59 AC 59 ms
22,760 KB
testcase_60 AC 60 ms
18,724 KB
testcase_61 AC 58 ms
20,816 KB
testcase_62 AC 61 ms
20,760 KB
testcase_63 AC 60 ms
20,792 KB
testcase_64 AC 59 ms
22,900 KB
testcase_65 AC 58 ms
20,876 KB
testcase_66 AC 59 ms
20,740 KB
testcase_67 AC 60 ms
22,784 KB
testcase_68 AC 59 ms
20,852 KB
testcase_69 AC 60 ms
22,872 KB
testcase_70 AC 58 ms
22,788 KB
testcase_71 AC 59 ms
20,796 KB
testcase_72 AC 60 ms
18,760 KB
testcase_73 AC 60 ms
20,848 KB
testcase_74 AC 57 ms
20,840 KB
testcase_75 AC 57 ms
20,796 KB
testcase_76 AC 58 ms
20,840 KB
testcase_77 AC 60 ms
22,856 KB
testcase_78 AC 59 ms
20,700 KB
testcase_79 AC 57 ms
24,860 KB
testcase_80 AC 56 ms
20,752 KB
testcase_81 AC 56 ms
22,892 KB
testcase_82 AC 56 ms
20,676 KB
testcase_83 AC 55 ms
22,808 KB
testcase_84 AC 59 ms
18,800 KB
testcase_85 AC 59 ms
20,848 KB
testcase_86 AC 56 ms
20,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.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplicationSharp
{
	class Program
	{
		static void Main(string[] args)
		{
			ulong mod = (ulong)1e9 + 7;
			string[] s = Console.ReadLine().Split(' ');
			int n = int.Parse(s[0]), k = int.Parse(s[1]);
			if (k == 0)
			{
				//答えはn!
				ulong ret = 1;
				for (int i = 2; i <= n; i++) ret = (ret * (ulong)i) % mod;
				Console.WriteLine(ret);
			}
			else
			{
				s = Console.ReadLine().Split(' ');
				int count = 0;
				ulong[] a = new ulong[k+2];
				for (int i = 0; i < k; i++)	a[i + 1] = ulong.Parse(s[i]);
				a[0] = 0;	a[k + 1] = (1UL << n) - 1;
				Array.Sort(a);
				ulong ret = 1;
				//a[0]=0は確定->ret=1
				for(int i = 1; i < k+2; i++)
				{
					if ((a[i] & a[i - 1]) != a[i - 1])
					{
						ret = 0;
						break;
					}
					ulong diff = a[i] ^ a[i - 1];
					ulong cnt = 0;
					for(int j = 0; j < n; j++)
					{
						if ((diff >> j) % 2L == 1L) cnt++;
					}
					for (ulong j = 2; j <= cnt; j++) ret = (ret * j) % mod;
				}
				Console.WriteLine(ret);
			}
		}
	}
}
0