Submission #45198
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include "bits/stdc++.h" // {{{ using namespace std; #define val const auto #define eb emplace_back #define emp emplace #define fi first #define se second #define X first #define Y second #define outl(x) cout << (x) << '\n' #define rep(i,n) for(int i=0; i < (int)(n); ++i) #define ALL(x) begin(x), end(x) #define TMPLT(T,U) template<class T, class U> #define ten(p) ((long long)(1e##p)) #define FILL(a,v) memset((a), (v), sizeof(a)) #define FAST() ios::sync_with_stdio(false), cin.tie(nullptr) #ifndef DEBUG #define debug(...) #define show(x) #define show2(x,y) #define LN() #endif typedef long long ll; typedef pair< int , int > pii; namespace ydk{ TMPLT(T,U) inline bool chmax(T &a, U b){ return b>a ? a=b,1 : 0;} TMPLT(T,U) inline bool chmin(T &a, U b){ return b<a ? a=b,1 : 0;} TMPLT(T,U) inline constexpr common_type_t<T,U> gcd(T x, U y) { return (x<y)? gcd(y,x) : (y <= 0)? x : gcd(y, x % y); } TMPLT(T,U) inline constexpr ll lcm(T x, U y) { return (ll)x/gcd(x,y) * y; } constexpr int INF = 0x3f3f3f3f; constexpr ll LINF = 0x3f3f3f3f3f3f3f3fLL; // }}} constexpr int MX = ten(5) + 10; constexpr int MOD = ten(5) + 5; int N, P; int dp[105][256]; int slv( int cnt, int lv) { if (lv < 0) return 0; int &ret = dp[cnt][lv]; if (~ret) { return ret; } if (cnt == N) { return ret = (lv==P ? 1 : 0); } return ret = ( slv(cnt+1, lv+1) + slv(cnt+1, lv-1) ) % MOD; } void Xx_main_xX() { cin >> P >> N; FILL(dp, -1); outl(slv(1,0)); return ; } } // {{{ signed main(){cout << fixed << setprecision(9); ydk::Xx_main_xX(); return 0;} // }}} |
ステータス
項目 | データ |
---|---|
問題 | 0410 - メロディ作り |
ユーザー名 | Arumakan_ei1727 |
投稿日時 | 2018-11-19 18:53:28 |
言語 | C++14 |
状態 | Accepted |
得点 | 10 |
ソースコード長 | 1718 Byte |
最大実行時間 | 27 ms |
最大メモリ使用量 | 728 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 10 / 10 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
test01.txt | AC | 24 ms | 728 KB |
1
|
test02.txt | AC | 20 ms | 724 KB |
1
|
test03.txt | AC | 24 ms | 716 KB |
1
|
test04.txt | AC | 25 ms | 580 KB |
1
|
test05.txt | AC | 19 ms | 704 KB |
1
|
test06.txt | AC | 23 ms | 700 KB |
1
|
test07.txt | AC | 27 ms | 696 KB |
1
|
test08.txt | AC | 19 ms | 696 KB |
1
|
test09.txt | AC | 23 ms | 692 KB |
1
|
test10.txt | AC | 20 ms | 552 KB |
1
|