結果

問題 No.462 6日知らずのコンピュータ
ユーザー fiordfiord
提出日時 2017-02-28 15:32:09
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,089 bytes
コンパイル時間 4,579 ms
コンパイル使用メモリ 106,764 KB
実行使用メモリ 24,784 KB
最終ジャッジ日時 2023-09-02 16:47:38
合計ジャッジ時間 13,411 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,880 KB
testcase_01 AC 61 ms
22,864 KB
testcase_02 WA -
testcase_03 AC 61 ms
22,804 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 61 ms
20,804 KB
testcase_07 WA -
testcase_08 AC 57 ms
20,740 KB
testcase_09 AC 59 ms
18,696 KB
testcase_10 AC 60 ms
20,868 KB
testcase_11 AC 60 ms
22,800 KB
testcase_12 AC 62 ms
22,816 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 60 ms
20,832 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 60 ms
20,788 KB
testcase_19 AC 60 ms
20,804 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 62 ms
20,752 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 60 ms
22,840 KB
testcase_28 AC 62 ms
22,928 KB
testcase_29 WA -
testcase_30 AC 60 ms
20,812 KB
testcase_31 WA -
testcase_32 AC 61 ms
22,732 KB
testcase_33 AC 60 ms
20,704 KB
testcase_34 WA -
testcase_35 AC 60 ms
20,768 KB
testcase_36 WA -
testcase_37 AC 61 ms
20,792 KB
testcase_38 AC 61 ms
20,876 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 60 ms
22,736 KB
testcase_45 AC 61 ms
20,728 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 62 ms
20,784 KB
testcase_50 AC 61 ms
20,760 KB
testcase_51 AC 61 ms
20,784 KB
testcase_52 AC 62 ms
22,812 KB
testcase_53 AC 60 ms
20,700 KB
testcase_54 AC 61 ms
20,856 KB
testcase_55 AC 61 ms
20,708 KB
testcase_56 AC 61 ms
18,704 KB
testcase_57 AC 62 ms
22,828 KB
testcase_58 AC 60 ms
18,688 KB
testcase_59 AC 64 ms
20,912 KB
testcase_60 AC 62 ms
20,812 KB
testcase_61 AC 62 ms
22,916 KB
testcase_62 AC 61 ms
20,884 KB
testcase_63 AC 61 ms
18,652 KB
testcase_64 AC 61 ms
20,744 KB
testcase_65 AC 61 ms
20,860 KB
testcase_66 AC 62 ms
20,784 KB
testcase_67 AC 60 ms
22,872 KB
testcase_68 AC 60 ms
20,712 KB
testcase_69 AC 61 ms
22,848 KB
testcase_70 AC 62 ms
20,872 KB
testcase_71 AC 61 ms
20,780 KB
testcase_72 AC 60 ms
20,812 KB
testcase_73 AC 61 ms
22,748 KB
testcase_74 AC 60 ms
20,824 KB
testcase_75 AC 61 ms
20,852 KB
testcase_76 AC 61 ms
20,860 KB
testcase_77 AC 60 ms
18,764 KB
testcase_78 AC 61 ms
22,828 KB
testcase_79 AC 56 ms
20,688 KB
testcase_80 AC 57 ms
20,656 KB
testcase_81 AC 57 ms
20,772 KB
testcase_82 AC 58 ms
20,720 KB
testcase_83 AC 58 ms
20,716 KB
testcase_84 AC 61 ms
20,872 KB
testcase_85 AC 61 ms
22,824 KB
testcase_86 AC 57 ms
20,756 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)
		{
			long mod = (long)1e9 + 7;
			string[] s = Console.ReadLine().Split(' ');
			int n = int.Parse(s[0]), k = int.Parse(s[1]);
			if (k == 0)
			{
				//答えはn!
				long ret = 1;
				for (int i = 2; i <= n; i++) ret = (ret * i) % mod;
				Console.WriteLine(ret);
			}
			else
			{
				s = Console.ReadLine().Split(' ');
				long[] a = new long[k+2];
				for (int i = 0; i < k; i++) a[i+1] = long.Parse(s[i]);
				a[0] = 0;	a[k + 1] = (1 << n) - 1;
				Array.Sort(a);
				long 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;
					}
					long diff = a[i] ^ a[i - 1];
					int cnt = 0;
					for(int j = 0; j < n; j++)
					{
						if ((diff >> j) % 2 == 1) cnt++;
					}
					for (int j = 2; j <= cnt; j++) ret = (ret * j) % mod;
				}
				Console.WriteLine(ret);
			}
		}
	}
}
0