結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2018-07-14 00:43:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 661 bytes |
コンパイル時間 | 1,669 ms |
コンパイル使用メモリ | 166,376 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-09 05:52:36 |
合計ジャッジ時間 | 2,298 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 WA * 3 |
ソースコード
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<double, int> P; typedef pair<int, P> E; #define MOD (1000000007ll) #define l_ength size #define EPS (1e-10) void add_mod(ll &a, ll b){ a += b; a %= MOD; } void mul_mod(ll &a, ll b){ a *= b; a %= MOD; } int main(void){ int n,i,j,w[123],s=0; bool p[12345]; cin >> n; fill(p,p+12345,true); p[0] = false; for(i=0; i<n; ++i){ cin >> w[i]; s += w[i]; } for(i=0; i<n; ++i){ for(j=w[i]; j<=10000; ++j){ if(!p[j-w[i]]){ p[j] = false; } } } cout << ((s%2 || p[s/2])?"im":"") << "possible" << endl; return 0; }