結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2017-12-07 03:49:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 168,960 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-29 02:03:39 |
合計ジャッジ時間 | 2,719 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 4 |
ソースコード
#include <bits/stdc++.h> #define FOR(i,a,b) for(int i = (a); i < (b); ++i) #define REP(i,n) FOR(i,0,n) #define SZ(n) (int)(n).size() #define ALL(n) (n).begin(), (n).end() #define MOD % 1000000007 #define INF 100000000 using namespace std; typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PI; int main() { int n; int w[101] = {}; cin >> n; REP(i, n) cin >> w[i]; sort(w, w + n, greater<int>()); int r = 0, l = 0; for (int e : w) { (r > l) ? l += e : r += e; } cout << (r == l ? "possible" : "impossible") << endl; return 0; }