結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-01-10 13:54:01 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 5,000 ms |
| コード長 | 304 bytes |
| 記録 | |
| コンパイル時間 | 1,730 ms |
| コンパイル使用メモリ | 168,024 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-10 13:54:05 |
| 合計ジャッジ時間 | 2,533 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#include <iostream>
#include <vector>
int main(){
int N;std::cin>>N;
std::vector<int> W(N);for(auto& w:W)std::cin>>w;
int sum=0;
for(auto& w:W)sum+=w;
std::vector<bool> X(2*sum+1);
X[0]=1;
for(auto& w:W)for(int i=2*sum;i>=2*w;i--)X[i]=X[i-2*w]|X[i];
std::cout<<(X[sum]?"possible":"impossible");
}