제출 #575713

#제출 시각아이디문제언어결과실행 시간메모리
575713hoainiemKangaroo (CEOI16_kangaroo)C++14
0 / 100
8 ms16084 KiB
#include <bits/stdc++.h> //#pragma GCC target("popcnt") #define fi first #define se second #define lc id<<1 #define rc id<<1^1 #define val f[i][j] const int mod = 1e9 + 7; double begintime, endtime; using namespace std; inline void CALC_TIME() { endtime = clock(); cout << "\nexecution time : " << (endtime - begintime + 1) / 1000 << " s"; } void add(int &x, int y) { x += y; if (x >= mod) x -= mod; } int mul(int x, int y) { return 1LL * x * y % mod; } typedef pair<int, int> pii; int n, cs, cf; int f[2008][2008]; int dq(int i, int j) { if (val != -1) return val; if (i == n) return val = (j == 1); int res = 0; if (i + 1 == cs || i + 1 == cf) { add(res, dq(i + 1, j)); add(res, dq(i + 1, j + 1)); return val = res; } if (j > 1) add(res, mul(j - 1, dq(i + 1, j - 1))); add(res, mul(j + 1 - (i + 1 > cs) - (i + 1 > cf), dq(i + 1, j + 1))); return val = res; } int main() { begintime = clock(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen("file.inp", "r", stdin); freopen("file.out", "w", stdout); #endif memset(f, -1, sizeof(f)); cin >> n >> cs >> cf; cout << dq(0, 0); return 0; }

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

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