結果
| 問題 | No.329 全射 |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2015-12-22 09:23:50 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 880 bytes |
| 記録 | |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 22,656 KB |
| 実行使用メモリ | 7,396 KB |
| 最終ジャッジ日時 | 2024-09-18 18:32:46 |
| 合計ジャッジ時間 | 3,411 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 32 |
コンパイルメッセージ
main.c:3:1: warning: data definition has no type or storage class
3 | noktbl[1010][1010];
| ^~~~~~
main.c:3:1: warning: type defaults to ‘int’ in declaration of ‘noktbl’ [-Wimplicit-int]
main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
4 | nok(n,k){
| ^~~
main.c: In function ‘nok’:
main.c:4:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
main.c:4:1: warning: type of ‘k’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:11:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
11 | pow(n,e){
| ^~~
main.c:11:1: warning: conflicting types for built-in function ‘pow’; expected ‘double(double, double)’ [-Wbuiltin-declaration-mismatch]
main.c:1:1: note: ‘pow’ is declared in header ‘<math.h>’
+++ |+#include <math.h>
1 | #define mod 1000000007
main.c: In function ‘pow’:
main.c:11:1: warning: type of ‘n’ defaults to ‘int’ [-Wimplicit-int]
11 | pow(n,e){
| ^~~
main.c:11:1: warning: type of ‘e’ defaults to ‘int’ [-Wimplicit-int]
main.c: At top level:
main.c:15:1: warning: data definition has no type or storage class
15 | w[210];ln[210][210];li[210];u[210];a[210];ai;
| ^
main.c:15:1: warning: type defaults to ‘int’ in declaration of ‘w’ [-Wimplicit-int]
main.c:15:8: warning: data definition has no type or storage class
15 | w[210];ln[210][210];li[210];u[210];a[210];ai;
| ^~
main.c:15:8: warning: type defaults to ‘int’ in declaration of ‘ln’ [-Wimplicit-int]
main.c:15:21: warning: data definition has no type or storage class
15 | w[210];ln[210][210];li[210];u[210];a[210];ai;
| ^~
main.c:15:21: warning: type defaults to ‘int’ in declaration of ‘li’ [-Wimplicit-int]
main.c:15:29: warning: data definition has no type or storage class
15 | w[210];ln[210][210];li[210];u[210];a[210];ai;
| ^
main.c:15:29: warni
ソースコード
#define mod 1000000007
noktbl[1010][1010];
nok(n,k){
if(!noktbl[n][k]){
noktbl[n][k]=k==0||k==n?1:(nok(n-1,k)+nok(n-1,k-1))%mod;
}
return noktbl[n][k];
}
pow(n,e){
return e?(e&1?n:1)*pow(n*n,e/2)%mod:1;
}
w[210];ln[210][210];li[210];u[210];a[210];ai;
rtbl[1010][1010];
main(i,j,k,l,m,n,r,s,t){
scanf("%d%d",&n,&m);
for(i=1;i<=n;++i)scanf("%d",w+i);
for(k=0;k<m;++k){
scanf("%d%d",&i,&j);
ln[i][li[i]++]=j;
}
r=0;
for(k=1;k<=n;++k){
memset(u,0,sizeof u);
u[k]++;
ai=0;
a[ai++]=k|w[k]<<8;
while(ai){
l=a[--ai];
s=l>>8;
l&=255;
t=w[l];
if(s>=t){
if(!rtbl[s][t]){
long long h=0;
for(i=1;i<=t;++i){
h=nok(t,i)*pow(i,s)-h;
}
rtbl[s][t]=h%mod;
}
r=(r+rtbl[s][t])%mod;
}
if(s>t)s=t;
for(i=0;j=ln[l][i];++i){
if(!u[j]++){
a[ai++]=j|s<<8;
}
}
}
}
printf("%d",r);
return 0;
}
tails