Submission #1162733

#TimeUsernameProblemLanguageResultExecution timeMemory
1162733hainam2k9Tents (JOI18_tents)C++20
0 / 100
0 ms1160 KiB
#include <bits/stdc++.h>
#define tt cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(0)
#define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define db long double
#define sz(a) ((int)(a).size())
#define pb emplace_back
#define pf emplace_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define ins emplace
#define mp make_pair
using namespace std;
const int MOD = 1e9+7, MAXN = 1e5+5;
const string NAME = "";
int n,m,dp[3005][3005];
void add(int &a, int b){
    a+=b;
    if(a>=MOD) a-=MOD;
}
int main()
{
    tt;
    if(fopen((NAME + ".INP").c_str(), "r")) fo;
    cin >> n >> m;
    for(int i = 0; i<=n; ++i)
        for(int j = 0; j<=m; ++j){
            if(i==0||j==0){
                dp[i][j]=1;
                continue;
            }
            dp[i][j]=dp[i-1][j];
            add(dp[i][j],4ll*j*dp[i-1][j-1]);
            if(j>=2) add(dp[i][j],1ll*j*(j-1)/2*dp[i-1][j-2]);
            if(i>=2) add(dp[i][j],1ll*j*(i-1)*dp[i-2][j-1]);
        }
    add(dp[n][m],MOD-1);
    cout << dp[n][m];
}

Compilation message (stderr)

tents.cpp: In function 'int main()':
tents.cpp:3:19: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tents.cpp:30:45: note: in expansion of macro 'fo'
   30 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
tents.cpp:3:63: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    3 | #define fo freopen((NAME+".INP").c_str(), "r", stdin), freopen((NAME+".OUT").c_str(), "w", stdout)
      |                                                        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tents.cpp:30:45: note: in expansion of macro 'fo'
   30 |     if(fopen((NAME + ".INP").c_str(), "r")) fo;
      |                                             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...