結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
lowr
|
| 提出日時 | 2018-11-02 13:04:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 497 bytes |
| コンパイル時間 | 1,662 ms |
| コンパイル使用メモリ | 171,244 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-20 13:05:49 |
| 合計ジャッジ時間 | 2,717 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#include <bits/stdc++.h>
int main() {
int n;
std::cin >> n;
std::vector<int> w(n);
int t = 0;
for (int i = 0; i < n; i++) {
std::cin >> w[i];
t += w[i];
}
if (t % 2) {
std::cout << "impossible" << std::endl;
return 0;
}
t /= 2;
std::bitset<5050> b;
for (int i = 0; i < n; i++) {
b = b | (b << w[i]);
b[w[i]] = true;
}
std::cout << (b[t] ? "possible" : "impossible") << std::endl;
return 0;
}
lowr