結果
問題 | No.2155 みちらcolor |
ユーザー | tnakao0123 |
提出日時 | 2022-12-10 16:53:55 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 706 bytes |
コンパイル時間 | 765 ms |
コンパイル使用メモリ | 56,696 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-14 23:47:39 |
合計ジャッジ時間 | 2,000 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 64 |
ソースコード
/* -*- coding: utf-8 -*- * * 2155.cc: No.2155 みちらcolor - yukicoder */ #include<cstdio> #include<bitset> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 100; const int MAX_A = 1000; /* typedef */ typedef bitset<MAX_A+1> btst; /* global variables */ int as[MAX_N]; btst dp[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n, m, l; scanf("%d%d%d", &n, &m, &l); for (int i = 0; i < n; i++) scanf("%d", as + i); dp[0][l] = true; for (int i = 0; i < n; i++) { dp[i + 1] = dp[i]; for (int j = 1; j <= MAX_A; j++) if (dp[i][j]) dp[i + 1][(j + as[i]) / 2] = true; } if (dp[n][m]) puts("Yes"); else puts("No"); return 0; }