結果
問題 | No.1782 ManyCoins |
ユーザー | SSRS |
提出日時 | 2021-12-11 00:07:30 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 804 bytes |
コンパイル時間 | 1,604 ms |
コンパイル使用メモリ | 173,808 KB |
実行使用メモリ | 31,064 KB |
最終ジャッジ日時 | 2023-09-26 00:23:52 |
合計ジャッジ時間 | 19,779 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 3 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 2 ms
4,380 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 5 ms
11,008 KB |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 6 ms
10,708 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
testcase_50 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; const long long INF = 1000000000000000000; int main(){ int N; long long L; cin >> N >> L; vector<int> W(N); for (int i = 0; i < N; i++){ cin >> W[i]; } vector<long long> dp(W[0], INF); dp[0] = 0; for (int i = 1; i < N; i++){ vector<pair<long long, int>> P(W[0]); for (int j = 0; j < W[0]; j++){ P[j] = make_pair(dp[j], j); } sort(P.begin(), P.end()); for (int j = 0; j < W[0]; j++){ int v = P[j].second; long long x = dp[v]; long long y = x + W[i]; int w = (v + W[i]) % W[0]; if (dp[w] > y){ dp[w] = y; } } } long long ans = 0; for (int i = 0; i < W[0]; i++){ if (dp[i] <= L){ ans += (L - dp[i]) / W[0] + 1; } } cout << ans - 1 << endl; }