結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
sugarrr
|
| 提出日時 | 2018-01-04 14:09:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 598 bytes |
| コンパイル時間 | 637 ms |
| コンパイル使用メモリ | 66,868 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-23 03:37:17 |
| 合計ジャッジ時間 | 1,762 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 10 |
ソースコード
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
typedef long long ll;
using namespace std;
int main(){
int n;cin>>n;
int w[n+1];for(int i=1;i<=n;i++)cin>>w[i];
bool dp[n+1][22001];
for(int i=0;i<=22000;i++)dp[0][i]=false;
dp[0][11000]=true;
for(int i=1;i<=n;i++)for(int j=0;j<=22000;j++){
dp[i][j]=(dp[i-1][j+w[i]]||dp[i-1][j-w[i]]);
}
if(dp[n][11000]==true)printf("possible");
else printf("impposible");
return 0;
}
sugarrr