Submission #413603

#TimeUsernameProblemLanguageResultExecution timeMemory
413603jamezzzTents (JOI18_tents)C++14
100 / 100
325 ms71236 KiB
#include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; #include <ext/rope> using namespace __gnu_cxx; typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds; //less_equal for identical elements //#define DEBUG #ifdef DEBUG #define debug(...) printf(__VA_ARGS__); #else #define debug(...) #endif #define sf scanf #define pf printf #define fi first #define se second #define pb emplace_back #define sz(x) (int)x.size() #define mnto(x,y) x=min(x,(__typeof__(x))y) #define mxto(x,y) x=max(x,(__typeof__(x))y) #define INF 1023456789 #define LINF 1023456789123456789 #define all(x) x.begin(), x.end() typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef pair<ll, ll> pll; typedef tuple<int, int, int> iii; typedef tuple<int, int, int, int> iiii; typedef vector<int> vi; typedef vector<ii> vii; typedef vector<pll> vll; #define mod 1000000007 ll m[3005][3005]; ll dp(int h,int w){ if(h<0||w<0)return 0; if(h==0||w==0)return 1; if(m[h][w]!=-1)return m[h][w]; if(h==1)return 4*w+1+w*(w-1)/2; return m[h][w]=(dp(h-1,w)+4*w*dp(h-1,w-1)+w*(w-1)/2*dp(h-1,w-2)+w*(h-1)*dp(h-2,w-1))%mod; } int main(){ int h,w;sf("%d%d",&h,&w); memset(m,-1,sizeof m); pf("%lld\n",(dp(h,w)-1+mod)%mod); }

Compilation message (stderr)

tents.cpp: In function 'int main()':
tents.cpp:53:12: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |  int h,w;sf("%d%d",&h,&w);
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...