結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
ei1333333
|
| 提出日時 | 2014-10-29 22:21:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 512 bytes |
| コンパイル時間 | 1,465 ms |
| コンパイル使用メモリ | 159,200 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-30 13:44:57 |
| 合計ジャッジ時間 | 2,436 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 21 WA * 2 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
const int INF = 1 << 30;
int main(){
int N, W[100];
bool dp[101][10001] = {};
cin >> N;
for(int i = 0; i < N; i++){
cin >> W[i];
}
dp[0][0] = true;
for(int i = 0; i < N; i++){
for(int j = 10000; j >= 0; j--){
if(j - W[i] >= 0) dp[i + 1][j - W[i]] |= dp[i][j];
dp[i + 1][j + W[i]] |= dp[i][j];
}
}
if(dp[N][0]) cout << "possible" << endl;
else cout << "impossible" << endl;
}
ei1333333