結果
| 問題 |
No.462 6日知らずのコンピュータ
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2016-12-13 01:12:01 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,585 bytes |
| コンパイル時間 | 2,422 ms |
| コンパイル使用メモリ | 112,948 KB |
| 実行使用メモリ | 28,348 KB |
| 最終ジャッジ日時 | 2024-11-29 23:54:23 |
| 合計ジャッジ時間 | 6,689 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 WA * 30 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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));}
}
kuuso1