結果
問題 | No.5 数字のブロック |
ユーザー |
![]() |
提出日時 | 2015-07-24 06:38:33 |
言語 | C++11 (gcc 8.5.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 752 bytes |
コンパイル時間 | 1,823 ms |
コンパイル使用メモリ | 143,460 KB |
実行使用メモリ | 332,496 KB |
最終ジャッジ日時 | 2023-09-22 22:04:48 |
合計ジャッジ時間 | 37,477 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 2,671 ms
212,712 KB |
testcase_04 | AC | 182 ms
6,236 KB |
testcase_05 | AC | 3,411 ms
254,280 KB |
testcase_06 | AC | 1,049 ms
97,372 KB |
testcase_07 | AC | 1,700 ms
149,280 KB |
testcase_08 | AC | 1,268 ms
86,720 KB |
testcase_09 | AC | 353 ms
41,248 KB |
testcase_10 | AC | 1,838 ms
129,152 KB |
testcase_11 | AC | 540 ms
39,932 KB |
testcase_12 | AC | 3,737 ms
209,620 KB |
testcase_13 | AC | 1,672 ms
131,972 KB |
testcase_14 | AC | 58 ms
36,732 KB |
testcase_15 | AC | 5 ms
4,380 KB |
testcase_16 | AC | 3,077 ms
220,292 KB |
testcase_17 | AC | 4,328 ms
332,496 KB |
testcase_18 | AC | 2,526 ms
185,612 KB |
testcase_19 | TLE | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0;i<n;i++) #define reps(i,m,n) for(int i=m;i<n;i++) typedef long long ll; typedef unsigned long long ull; typedef unsigned int uint; typedef vector<int> vec; typedef vector<vec> mat; static const double EPS = 1e-9; static const double PI = acos(-1.0); const int INF = 1e9; const int mod = 1e9 + 7; const int MAX = 10010; int dp[MAX][MAX] = {0}; int W[MAX]; int L, N; int rec(int l, int n){ if(l > L || n > N) return -1; if(dp[l][n] > 0){ return dp[l][n]; } int& res = dp[l][n]; res = max(rec(l, n+1), 1+rec(l+W[n], n+1)); return res; } int main(){ cin >> L >> N; rep(i, N) cin >> W[i]; cout << rec(0, 0) << endl; return 0; }