結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-05-06 23:38:41 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 17 ms / 5,000 ms | 
| コード長 | 378 bytes | 
| コンパイル時間 | 1,884 ms | 
| コンパイル使用メモリ | 194,696 KB | 
| 最終ジャッジ日時 | 2025-02-21 11:28:55 | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    int sumw = 0;
    bitset<5001> ok; ok.set(0);
    while(N--){
        int w; cin >> w; sumw += w;
        ok |= ok<<w;
    }
    if(sumw%2 == 0 && ok.test(sumw/2)) cout << "possible" << endl;
    else cout << "impossible" << endl;
}
            
            
            
        