結果

問題 No.4 おもりと天秤
ユーザー nonon
提出日時 2025-08-15 12:07:30
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 551 bytes
コンパイル時間 2,864 ms
コンパイル使用メモリ 278,732 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-08-15 12:07:35
合計ジャッジ時間 4,492 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; }
bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    bitset<10101> bit;
    bit.set(0);
    int S = 0;
    for (int i = 0; i < N; i++) {
        int A;
        cin >> A;
        bit |= bit << A;
        S += A;
    }
    cout << (S % 2 == 0 && bit.test(S / 2) ? "possible" : "impossible") << endl;
}
0