結果

問題 No.462 6日知らずのコンピュータ
ユーザー fiordfiord
提出日時 2017-02-28 00:40:11
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,172 bytes
コンパイル時間 2,850 ms
コンパイル使用メモリ 111,204 KB
実行使用メモリ 26,328 KB
最終ジャッジ日時 2024-06-11 20:19:54
合計ジャッジ時間 7,148 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
26,064 KB
testcase_01 AC 23 ms
23,920 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 22 ms
23,796 KB
testcase_09 AC 24 ms
24,108 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 WA -
testcase_28 AC 23 ms
24,272 KB
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 AC 25 ms
24,296 KB
testcase_34 RE -
testcase_35 WA -
testcase_36 RE -
testcase_37 WA -
testcase_38 AC 25 ms
26,084 KB
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 AC 25 ms
26,220 KB
testcase_45 WA -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 AC 23 ms
23,980 KB
testcase_50 RE -
testcase_51 AC 22 ms
21,936 KB
testcase_52 RE -
testcase_53 AC 23 ms
24,176 KB
testcase_54 AC 25 ms
25,960 KB
testcase_55 AC 24 ms
23,920 KB
testcase_56 RE -
testcase_57 RE -
testcase_58 AC 24 ms
23,888 KB
testcase_59 RE -
testcase_60 RE -
testcase_61 AC 25 ms
24,112 KB
testcase_62 WA -
testcase_63 AC 23 ms
22,068 KB
testcase_64 AC 23 ms
23,928 KB
testcase_65 AC 24 ms
23,920 KB
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 AC 22 ms
24,140 KB
testcase_71 RE -
testcase_72 AC 22 ms
24,432 KB
testcase_73 AC 23 ms
25,940 KB
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 AC 22 ms
23,920 KB
testcase_80 AC 21 ms
23,936 KB
testcase_81 AC 22 ms
25,880 KB
testcase_82 AC 22 ms
23,792 KB
testcase_83 AC 21 ms
24,216 KB
testcase_84 AC 28 ms
26,068 KB
testcase_85 AC 24 ms
24,016 KB
testcase_86 AC 25 ms
26,088 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(' ');
				int[] a = new int[k];
				for (int i = 0; i < k; i++) a[i] = int.Parse(s[i]);
				Array.Sort(a);
				long ret = 1;
				int cnt = 0;
				for (int i = 0; (1 << i) <= a[0]; i++)
				{
					if ((a[0]>>i)%2==1) cnt++;
				}
				for (int i = 2; i <= cnt; i++) ret = (ret * cnt) % mod;
				for(int i = 1; i < k; i++)
				{
					if ((a[i] & a[i - 1]) != a[i - 1])
					{
						ret = 0;
						break;
					}
					int diff = a[i] ^ a[i - 1];
					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