結果

問題 No.462 6日知らずのコンピュータ
ユーザー kuuso1kuuso1
提出日時 2016-12-13 01:12:01
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,585 bytes
コンパイル時間 3,288 ms
コンパイル使用メモリ 112,968 KB
実行使用メモリ 27,708 KB
最終ジャッジ日時 2024-05-07 08:36:29
合計ジャッジ時間 4,743 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
17,792 KB
testcase_01 AC 21 ms
17,792 KB
testcase_02 AC 20 ms
17,792 KB
testcase_03 AC 21 ms
17,792 KB
testcase_04 AC 21 ms
17,920 KB
testcase_05 AC 20 ms
17,792 KB
testcase_06 WA -
testcase_07 AC 21 ms
17,536 KB
testcase_08 AC 21 ms
17,792 KB
testcase_09 AC 20 ms
17,536 KB
testcase_10 AC 21 ms
17,792 KB
testcase_11 AC 20 ms
17,792 KB
testcase_12 AC 22 ms
17,664 KB
testcase_13 AC 21 ms
17,664 KB
testcase_14 AC 20 ms
17,792 KB
testcase_15 AC 21 ms
17,536 KB
testcase_16 AC 22 ms
17,792 KB
testcase_17 AC 23 ms
17,664 KB
testcase_18 AC 22 ms
17,792 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 21 ms
17,792 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 20 ms
17,792 KB
testcase_50 AC 22 ms
17,792 KB
testcase_51 AC 21 ms
17,792 KB
testcase_52 AC 22 ms
17,792 KB
testcase_53 AC 22 ms
17,920 KB
testcase_54 AC 22 ms
17,792 KB
testcase_55 AC 22 ms
17,664 KB
testcase_56 AC 21 ms
17,792 KB
testcase_57 AC 22 ms
17,536 KB
testcase_58 AC 22 ms
17,792 KB
testcase_59 AC 23 ms
17,792 KB
testcase_60 AC 21 ms
17,792 KB
testcase_61 AC 22 ms
17,792 KB
testcase_62 AC 22 ms
17,792 KB
testcase_63 AC 22 ms
17,664 KB
testcase_64 AC 22 ms
17,920 KB
testcase_65 AC 21 ms
17,536 KB
testcase_66 AC 23 ms
17,664 KB
testcase_67 AC 21 ms
17,920 KB
testcase_68 AC 21 ms
17,792 KB
testcase_69 AC 21 ms
17,792 KB
testcase_70 AC 22 ms
17,408 KB
testcase_71 AC 20 ms
17,792 KB
testcase_72 AC 20 ms
17,792 KB
testcase_73 AC 21 ms
17,792 KB
testcase_74 AC 21 ms
17,792 KB
testcase_75 AC 21 ms
17,536 KB
testcase_76 AC 22 ms
17,792 KB
testcase_77 AC 20 ms
17,792 KB
testcase_78 AC 20 ms
17,536 KB
testcase_79 AC 23 ms
17,792 KB
testcase_80 AC 22 ms
17,792 KB
testcase_81 AC 20 ms
17,792 KB
testcase_82 AC 21 ms
17,664 KB
testcase_83 AC 22 ms
17,792 KB
testcase_84 AC 21 ms
17,792 KB
testcase_85 AC 20 ms
17,792 KB
testcase_86 AC 21 ms
17,408 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.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		long mod = (long)1e9 + 7;
		
		long[] Fact = new long[N+1];
		Fact[0] = 1;
		for(int i=1;i<=N;i++){
			Fact[i] = Fact[i-1] * i;
			Fact[i] %= mod;
		}
		
		if(K==0){
			Console.WriteLine(Fact[N]);
			return;
		}
		
		int[] bc = new int[N];
		int tot = N;
		long ans = 1;
		for(int i=0;i<K;i++){
			long inc = A[i];
			if(i>0) inc -= A[i-1];
			int cnt = 0;
			for(int j=0;j<N;j++){
				if(((inc >> j)&1) == 1){ bc[j]++; cnt++;}
				if(bc[j]>1){
					Console.WriteLine(0);
					return;
				}
			}
			ans *= Fact[cnt];
			ans %= mod;
			tot -= cnt;
		}
		
		ans *= Fact[tot];
		ans %= mod;
		Console.WriteLine(ans);
		
		
		
		
		
	}
	int N,K;
	long[] A;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		if(K>0)A = rla();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
0