結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
nksk
|
| 提出日時 | 2017-04-22 10:39:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 532 bytes |
| コンパイル時間 | 678 ms |
| コンパイル使用メモリ | 74,004 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 10:14:19 |
| 合計ジャッジ時間 | 1,478 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
//typedef pair<int, int> P;
int main()
{
int w[10101] = { 1 };
int sum=0;
int N; cin >> N;
for (int i = 0; i < N; i++) {
int t;
cin >> t;
sum += t;
for (int j = 10000; j--; w[j + t] += w[j]);
}
cout << (sum % 2 == 1 || !w[sum / 2] ? "impossible" : "possible") << endl;
return 0;
}
nksk