제출 #1127660

#제출 시각아이디문제언어결과실행 시간메모리
1127660VinhLuuTents (JOI18_tents)C++20
100 / 100
176 ms70804 KiB
#include <bits/stdc++.h> #define ll long long #define all(lpv) lpv.begin(), lpv.end() #define pot(x, y) lower_bound(x.begin(), x.end(), y) - x.begin() + 1 using namespace std; #define lpv #ifndef lpv #include "AC.h" #endif // lpv #define int long long const int N = 3e3 + 5; const int mod = 1e9 + 7; int lt(int u,int v) { if(!v) return 1; int x = u, kq = 1; while(v) { if(v & 1) kq = kq * x % mod; x = x * x % mod; v /= 2; } return kq; } void get(int &x,int y) { x = (x + y) % mod; } int f[N][N], g[N][N], ft[N], inv[N]; int C(int u,int v) { if(!u || u == v) return 1; return ft[v] * inv[v - u] % mod * inv[u] % mod; } #ifdef lpv signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "v" if(fopen(task ".inp","r")) { freopen(task ".inp","r",stdin); freopen(task ".out","w",stdout); } int n, m; cin >> n >> m; for(int i = 0; i <= n; i ++) { for(int j = 0; j <= m; j ++) { if(!i || !j) {f[i][j] = 1; continue;} get(f[i][j], f[i - 1][j - 1] * 4 % mod * j % mod); get(f[i][j], f[i - 1][j]); if(i >= 2) get(f[i][j], f[i - 2][j - 1] * (i - 1) % mod * j % mod); if(j >= 2) get(f[i][j], f[i - 1][j - 2] * ((j * (j - 1) / 2) % mod) % mod); } } cout << (f[n][m] - 1 + mod) % mod; } #endif // lpv

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

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