結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
DaYuanChi
|
| 提出日時 | 2021-01-22 20:27:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 455 bytes |
| コンパイル時間 | 1,909 ms |
| コンパイル使用メモリ | 171,052 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-27 18:35:49 |
| 合計ジャッジ時間 | 3,042 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n; cin >> n;
vector<int> w(n);
for(int i = 0; i < n; i++) cin >> w[i];
sort(w.begin(), w.end());
int sum = 0;
for(int i = 0; i < n; i++) sum += w[i];
bool ans = false;
int sum2 = 0;
for(int i = 0; i < n; i++){
sum2 += w[i];
if(sum2*2==sum) ans = true;
}
if(ans) cout << "possible" << endl;
else cout << "impossible" << endl;
return 0;
}
DaYuanChi