結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2025-06-07 15:58:21 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 6,026 ms |
コンパイル使用メモリ | 212,672 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-06-07 15:58:29 |
合計ジャッジ時間 | 7,274 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; bitset<100*100+10> dp; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; int s=0; dp[0]=1; for(int i=0;i<N;++i){ int w;cin>>w; s+=w; dp|=dp<<w; } if(s&1) cout<<"impossible"; else cout<<(dp[s>>1]?"possible":"impossible"); cout<<endl; return 0; }