제출 #1256676

#제출 시각아이디문제언어결과실행 시간메모리
1256676nanaseyuzukiTents (JOI18_tents)C++20
0 / 100
16 ms35672 KiB
#include <bits/stdc++.h> /* --> Author: Kazuki_Hoshino__8703 <-- I love Nanasaki Ai ☆*: .。. o(≒_≒)o .。.:☆ */ #define fi first #define se second #define pii pair<int, int> #define ll long long using namespace std; const int mn = 3e3 + 5, bm = (1 << 11) + 1, mod = 1e9 + 7, offset = 5e4; const int inf = 1e9, base = 311; int H, W, dp[mn][mn]; int f(int i, int j){ if(dp[i][j] != -1) return dp[i][j]; if(i <= 0 || j <= 0) return 1; dp[i][j] = 0; // dp[i][j] : xét hàng thứ i và còn j hàng chưa sử dụng if(j >= 2) dp[i][j] += f(i - 1, j - 2) * j * (j - 1) / 2; dp[i][j] %= mod; if(i >= 2) dp[i][j] += f(i - 2, j - 1) * (i - 1) * j; dp[i][j] %= mod; dp[i][j] += f(i - 1, j - 1) * j * 4; dp[i][j] %= mod; dp[i][j] += f(i - 1, j); dp[i][j] %= mod; return dp[i][j]; } void solve(){ cin >> H >> W; memset(dp, -1, sizeof(dp)); cout << f(H, W) - 1 << '\n'; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); if(fopen("ROBOT.INP", "r")) { freopen("ROBOT.INP", "r", stdin); freopen("ROBOT.OUT", "w", stdout); } int t = 1; // cin >> t; while(t--) { solve(); } }

컴파일 시 표준 에러 (stderr) 메시지

tents.cpp: In function 'int main()':
tents.cpp:47:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |         freopen("ROBOT.INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
tents.cpp:48:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         freopen("ROBOT.OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...