제출 #1293817

#제출 시각아이디문제언어결과실행 시간메모리
1293817Hurryup_7735캥거루 (CEOI16_kangaroo)C++20
51 / 100
1494 ms68408 KiB
//In The Name Of ALLAH! #pragma GCC optimize("O3") #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; #define ll long long #define ld long double #define endl '\n' #define pb push_back #define pf push_front #define Zemur007 ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define bpc __builtin_popcountll #define btz __builtin_ctzll #define all(x) x.begin() , x.end() #define allr(x) x.rbegin() , x.rend() #define F first #define S second #define pll pair<ll , ll> #define turtle tuple<ll , ll , ll> #define pss pair<string , string> #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; #define indexed_set tree<pll , null_type , less<pll> , rb_tree_tag , tree_order_statistics_node_update> const ll sz = 2e2 + 5 , INF = 1e18 , MOD = 1e9 + 7; ll dp[sz][sz][sz][2]; //dp[l][i][j][0 / 1] ilk l ədəd start : i , end : j , inc: 0 , dec: 1 ll mask , i , j , l , k; void solve(){ ll n , cs , cf; cin >> n >> cs >> cf; dp[2][1][2][0] = 1; dp[2][2][1][1] = 1; for(l = 3 ; l <= n ; l++){ for(i = 1 ; i <= l ; i++){ for(j = 1 ; j <= l ; j++){ if(i == j) continue; for(k = i ; k < l ; k++){ dp[l][i][j][0] = (dp[l][i][j][0] + dp[l - 1][k][j - (j > i ? 1 : 0)][1]) % MOD; } for(k = 1 ; k < i ; k++){ dp[l][i][j][1] = (dp[l][i][j][1] + dp[l - 1][k][j - (j > i ? 1 : 0)][0]) % MOD; } } } } cout << (dp[n][cs][cf][0] + dp[n][cs][cf][1]) % MOD << endl; } signed main(){ Zemur007; //open; ll t = 1; // cin >> t; while(t--){ solve(); } // for(ll testcase = 1 ; testcase <= t ; testcase++){ // cout << "Case " << testcase << ":" << endl; // solve(); // } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...