結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2015-10-15 11:08:55 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 720 bytes |
コンパイル時間 | 499 ms |
コンパイル使用メモリ | 61,240 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-21 16:00:48 |
合計ジャッジ時間 | 3,581 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 RE * 18 |
ソースコード
#include <iostream> #include <vector> #include <cstring> #include <algorithm> #include <sstream> #define REP(i,a,b) for(i=a;i<b;i++) #define rep(i,n) REP(i,0,n) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; /* ここからが本編 */ /* */ /* 入力開始! */ /* 入力終了! */ static int dp[10010] = {1}; int main(void) { int i,j,l; int n; int w[100]; int sum = 0; /* 入力開始! */ cin >> n; rep(i,n) { cin >> w[i]; sum += w[i]; } /* 入力終了! */ rep(i,n) { rep(j,10005) { if(dp[j]) dp[j+w[i]] = 1; } } if(sum%2 == 0 && dp[sum/2] == 1) cout << "possible" << endl; else cout << "impossible" << endl; return 0; }