結果
問題 | No.329 全射 |
ユーザー |
![]() |
提出日時 | 2015-12-26 05:27:01 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 248 ms |
コンパイル使用メモリ | 36,032 KB |
実行使用メモリ | 9,176 KB |
最終ジャッジ日時 | 2024-09-19 00:13:27 |
合計ジャッジ時間 | 9,600 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 40 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:22:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d%d",&N,&M); | ~~~~~^~~~~~~~~~~~~~ main.cpp:23:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 23 | rep(i,N)scanf("%d",w+i); | ~~~~~^~~~~~~~~~ main.cpp:25:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 25 | rep(i,M){scanf("%d%d",&x,&y);x--; E[x][--y] = w[x];} | ~~~~~^~~~~~~~~~~~~~ main.cpp:8:22: warning: iteration 1000 invokes undefined behavior [-Waggressive-loop-optimizations] 8 | #define range(i,a,b) for(int i=(a);i<(b);i++) | ^~~ main.cpp:9:18: note: in expansion of macro ‘range’ 9 | #define rep(i,n) range(i,0,n) | ^~~~~ main.cpp:21:9: note: in expansion of macro ‘rep’ 21 | rep(i,W+1) rep(j,i+1) D[i+1][j+1] = (LL) (j+1)*(D[i][j+1]+D[i][j])%P; | ^~~ main.cpp:8:37: note: within this loop 8 | #define range(i,a,b) for(int i=(a);i<(b);i++) | ^ main.cpp:9:18: note: in expansion of macro ‘range’ 9 | #define rep(i,n) range(i,0,n) | ^~~~~ main.cpp:21:9: note: in expansion of macro ‘rep’ 21 | rep(i,W+1) rep(j,i+1) D[i+1][j+1] = (LL) (j+1)*(D[i][j+1]+D[i][j])%P; | ^~~
ソースコード
#include <algorithm> #include <stdio.h> using namespace std; typedef long long LL; #define range(i,a,b) for(int i=(a);i<(b);i++) #define rep(i,n) range(i,0,n) #define P 1000000007 #define W 1001 LL D[W][W]; int w[W-1],E[300][300]; int main(){ int N,M,x,y; LL A = 0; rep(i,W)rep(j,W) D[i][j] = 0; D[0][0] = 1; rep(i,W+1) rep(j,i+1) D[i+1][j+1] = (LL) (j+1)*(D[i][j+1]+D[i][j])%P; scanf("%d%d",&N,&M); rep(i,N)scanf("%d",w+i); rep(i,N){rep(j,N) E[i][j] = 0; E[i][i] = w[i];} rep(i,M){scanf("%d%d",&x,&y);x--; E[x][--y] = w[x];} rep(k,N) rep(i,N) rep(j,N) E[i][j] = max(E[i][j],min(E[i][k],E[k][j])); rep(i,N) rep(j,N) if(w[j] <= E[i][j]) A = (A+D[w[i]][w[j]])%P; printf("%lld\n",A); return 0; }