結果

問題 No.4 おもりと天秤
ユーザー ibuki2003ibuki2003
提出日時 2017-09-16 14:31:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 159,252 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 14:35:38
合計ジャッジ時間 2,005 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 WA -
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 WA -
testcase_19 AC 3 ms
6,940 KB
testcase_20 AC 3 ms
6,940 KB
testcase_21 AC 3 ms
6,940 KB
testcase_22 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long

int main(){
	int n,buf;
	int sum=0;
	bool can[10001]={true};
	cin>>n;
	REP(i,n){
		cin>>buf;
		sum+=buf;
		REPR(j,10000)
			if(can[j])can[j+buf]=true;
	}
	if(sum%2)cout<<"impossible"<<endl;
	else if(can[sum/2])cout<<"possible"<<endl;
	else cout<<"impoissible"<<endl;
	return 0;
}
0