제출 #878021

#제출 시각아이디문제언어결과실행 시간메모리
878021vjudge1캥거루 (CEOI16_kangaroo)C++17
100 / 100
21 ms31836 KiB
#include <bits/stdc++.h> using namespace std; #define task "a" #define etr "\n" #define ll long long #define ld long double #define pii pair<int,int> #define pli pair<long long,int> #define pll pair<long long, long long> #define fi first #define se second #define bg begin #define pb push_back #define pf push_front #define pob pop_back #define pof pop_front #define lwb lower_bound #define upb upper_bound #define range(x, l, r) x+l, x+1+r #define all(x) (x).bg(), (x).end() #define compact(x) x.resize(unique(all(x)) - (x).bg()) #define sq(x) ((x)*(x)) auto start = chrono::high_resolution_clock::now(); void start_timer() { start = chrono::high_resolution_clock::now(); } ld elapsed() { auto current = chrono::high_resolution_clock::now(); ld duration = chrono::duration_cast<chrono::nanoseconds>(current - start).count(); return duration / 1e9; } void freop() { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } template<typename U, typename V> istream& operator >> (istream& in, pair<U, V>& p) { in >> p.fi >> p.se; return in; } template<typename U, typename V> ostream& operator << (ostream& out, pair<U, V> p) { out << p.fi << ' ' << p.se; return out; } const int N=2e3, M=1e5, mod=1e9+7; int n, cs, cf; ll dp[N+5][N+5]; void process() { cin >> n >> cs >> cf; dp[1][1] = 1; for (int i=2; i<=n; i++) { for (int j=1; j<=n; j++) { if (i != cf && i != cs) { dp[i][j] = dp[i-1][j+1] * j % mod; dp[i][j] += dp[i-1][j-1] * (j - (i > cs) - (i > cf)) % mod; dp[i][j] %= mod; } else dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % mod; //cout << i << ' ' << j << ": " << dp[i][j] << etr; } } cout << dp[n][1]; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int t=1; //cin >> t; while (t--) process(); return 0; }

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

kangaroo.cpp: In function 'void freop()':
kangaroo.cpp:41:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   41 |  freopen(task".inp", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:42:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |  freopen(task".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...