結果
問題 | No.4 おもりと天秤 |
ユーザー |
![]() |
提出日時 | 2015-11-21 17:42:43 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 511 bytes |
コンパイル時間 | 566 ms |
コンパイル使用メモリ | 67,364 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 09:20:52 |
合計ジャッジ時間 | 1,612 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<iostream>#include<vector>#include<set>using namespace std;int main(){int n;set<int> check;check.insert(0);cin >> n;for(int i=0;i<n;i++){int buf;cin >> buf;set<int> memo;auto it = check.begin();while(it != check.end()){memo.insert( *it + buf );memo.insert( *it - buf );it++;}check = memo;}cout << (check.count(0) == 1 ? "possible" : "impossible") << endl;}