結果
問題 | No.4 おもりと天秤 |
ユーザー |
|
提出日時 | 2018-07-01 20:06:36 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 450 bytes |
コンパイル時間 | 482 ms |
コンパイル使用メモリ | 55,152 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-01 01:15:36 |
合計ジャッジ時間 | 3,341 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 RE * 21 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; int main(void) { int N; cin >> N; ll sum=0; int dp[10010] = {}; dp[0] = 1; for(int i=0; i<N; i++) { int a; cin >> a; sum += a; for(int j=0; j<10010; j++) if(dp[j]) dp[j+a] = 1; } if(!(sum&1) && dp[sum/2]) cout << "possible" << endl; else cout << "impossible" << endl; return 0; }