結果
問題 | No.329 全射 |
ユーザー | tails |
提出日時 | 2015-12-22 09:47:06 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 899 bytes |
コンパイル時間 | 311 ms |
コンパイル使用メモリ | 22,948 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-09-18 18:33:09 |
合計ジャッジ時間 | 5,882 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 0 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 0 ms
5,376 KB |
testcase_06 | AC | 0 ms
5,376 KB |
testcase_07 | WA | - |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 1 ms
5,376 KB |
testcase_10 | AC | 1 ms
5,376 KB |
testcase_11 | AC | 1 ms
5,376 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
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 | AC | 3 ms
5,376 KB |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
コンパイルメッセージ
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:11: warning: conflicting types for built-in function ‘pow’; expected ‘double(double, double)’ [-Wbuiltin-declaration-mismatch] 11 | long long pow(n,e)long long n;{ | ^~~ 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:11: warning: type of ‘e’ defaults to ‘int’ [-Wimplicit-int] 11 | long long pow(n,e)long long n;{ | ^~~ 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: warning: type defaults to ‘int’ in declaration of ‘u’ [-Wimplicit-int] main.c:15:
ソースコード
#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]; } long long pow(n,e)long long n;{ return e?(e&1?n:1)*pow(n*n%mod,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; s=t; } for(i=0;j=ln[l][i];++i){ if(!u[j]++){ a[ai++]=j|s<<8; } } } } printf("%d",r); return 0; }