답안 #49323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
49323 2018-05-25T21:25:31 Z okaybody10 Tents (JOI18_tents) C++11
100 / 100
439 ms 59340 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;
ll dp[3005][3005];
ll d(int h,int w)
{
    if(h<0 || w<0) return 0;
    if(h==0 || w==0) return 1;
    if(dp[h][w]) return dp[h][w];
    ll ret=0;
    ret+=d(h-1,w); ret%=MOD;
    ret+=4*w*d(h-1,w-1); ret%=MOD;
    ret+=w*(w-1)/2*d(h-1,w-2); ret%=MOD;
    ret+=(h-1)*w*d(h-2,w-1); ret%=MOD;
    return dp[h][w]=ret%MOD;
}
int main(){
    int h,w; scanf("%d %d",&w,&h);
    d(h,w);
    printf("%lld",(dp[h][w]+MOD-1)%MOD);
    return 0;
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:19:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     int h,w; scanf("%d %d",&w,&h);
              ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 1136 KB Output is correct
3 Correct 2 ms 1136 KB Output is correct
4 Correct 2 ms 1136 KB Output is correct
5 Correct 4 ms 1500 KB Output is correct
6 Correct 3 ms 1500 KB Output is correct
7 Correct 4 ms 1508 KB Output is correct
8 Correct 3 ms 1508 KB Output is correct
9 Correct 2 ms 1508 KB Output is correct
10 Correct 4 ms 1508 KB Output is correct
11 Correct 4 ms 1880 KB Output is correct
12 Correct 6 ms 2296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 1136 KB Output is correct
3 Correct 2 ms 1136 KB Output is correct
4 Correct 2 ms 1136 KB Output is correct
5 Correct 4 ms 1500 KB Output is correct
6 Correct 3 ms 1500 KB Output is correct
7 Correct 4 ms 1508 KB Output is correct
8 Correct 3 ms 1508 KB Output is correct
9 Correct 2 ms 1508 KB Output is correct
10 Correct 4 ms 1508 KB Output is correct
11 Correct 4 ms 1880 KB Output is correct
12 Correct 6 ms 2296 KB Output is correct
13 Correct 10 ms 8164 KB Output is correct
14 Correct 3 ms 8164 KB Output is correct
15 Correct 232 ms 36224 KB Output is correct
16 Correct 24 ms 36224 KB Output is correct
17 Correct 61 ms 36224 KB Output is correct
18 Correct 60 ms 36224 KB Output is correct
19 Correct 255 ms 41228 KB Output is correct
20 Correct 195 ms 41228 KB Output is correct
21 Correct 137 ms 41228 KB Output is correct
22 Correct 112 ms 41228 KB Output is correct
23 Correct 21 ms 41228 KB Output is correct
24 Correct 439 ms 59340 KB Output is correct
25 Correct 278 ms 59340 KB Output is correct
26 Correct 324 ms 59340 KB Output is correct
27 Correct 342 ms 59340 KB Output is correct