結果
問題 |
No.4 おもりと天秤
|
ユーザー |
![]() |
提出日時 | 2016-12-27 22:05:10 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 568 bytes |
コンパイル時間 | 1,361 ms |
コンパイル使用メモリ | 162,560 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-15 04:41:10 |
合計ジャッジ時間 | 1,999 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define FOR(i,a,b) for(int i=(a);i<(int)(b);i++) #define rep(i,n) FOR(i,0,n) #define ALL(x) (x).begin(),(x).end() int main() { int n; cin >> n; vector<int> w(n); ll tot = 0; for(int& i : w){ cin >> i; tot += i; } sort(ALL(w)); rep(i,n-1){ ll lw=0, rw=0; rep(j, i+1) lw += w[j]; rw = tot - lw; if(lw == rw) { puts("possible"); return 0; } } puts("impossible"); return 0; }