제출 #1197025

#제출 시각아이디문제언어결과실행 시간메모리
1197025sitingfakeKangaroo (CEOI16_kangaroo)C++20
100 / 100
30 ms23112 KiB
#include<bits/stdc++.h> using namespace std; // define #define execute cerr << " Time: " << fixed << setprecision(6) << (1.0 * clock() / CLOCKS_PER_SEC) << "s\n"; #define ll long long #define ld double #define ii pair<int,int> #define se second #define fi first #define iii pair<int,ii> #define all(v) v.begin(),v.end() #define bit(x,i) (((x)>>(i))&1LL) #define flip(x,i) ((x)^(1LL<<(i))) #define ms(d,x) memset(d,x,sizeof(d)) #define sitingfake 1 #define orz 1 //constant const ll mod = 1e9 + 7; const long long linf = 4557430888798830399; const int inf = 1061109567; const int maxarr = 1e6 + 5; const int dx[] = {0 , 1 , -1 , 0}; const int dy[] = {1 , 0 , 0 , -1}; template<typename T> bool maximize(T &a, const T &b) { if(a < b) {a = b; return 1;} return 0; } template<typename T> bool minimize(T &a, const T &b) { if(a > b) {a = b; return 1;} return 0; } inline void Plus(ll & a ,ll b) { b %= mod; a += b; if(a >= mod) a -= mod; if(a < 0) a += mod; return; } inline void Mul(ll & a, ll b) { a %= mod; b %= mod; a *= b; a %= mod; return; } //code const int maxn = 2e3 + 7; int n , s , t; ll dp[maxn][maxn]; void solve(void) { cin >> n >> s >> t; dp[0][0] = 1; for(int i = 1; i <= n ;i++) { for(int j = 1; j <= i ; j++) { if(i == s || i == t) { Plus(dp[i][j] , dp[i-1][j]); Plus(dp[i][j] , dp[i-1][j-1]); } else { Plus(dp[i][j] , dp[i-1][j+1] *(1ll * j)); Plus(dp[i][j] , dp[i-1][j-1] * 1ll * (j - (i > s) - (i > t))); } } } cout << dp[n][1]; } /** **/ signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "" if(fopen(task".inp","r")) { freopen(task".inp","r",stdin); freopen(task".out","w",stdout); } int tc; tc = 1; while(tc--) solve(); //execute; }

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

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