結果

問題 No.4 おもりと天秤
ユーザー w10y26w10y26
提出日時 2017-05-08 09:36:48
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 730 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 78,232 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 18:45:05
合計ジャッジ時間 1,663 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define ll long long
#define ffor(i,a,b) for (int i=(a);i<(b);i++)
#define rfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#define SIZE 100001
#define MOD 1000000007
#define INF 100000000
using namespace std;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	int v[100];
	rep(i,n) cin >> v[i];

	sort(v,v+n);
	int a = v[n-1];
	int b = 0;
	for(int i=n-2; 0<=i;i--){
		if(a<b) a += v[i];
		else b += v[i];
	}

	cout << ((a==b)?"possible":"impossible") << endl;
	return 0;
}
0