結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
HMSR73
|
| 提出日時 | 2015-11-16 19:48:19 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 556 ms |
| コンパイル使用メモリ | 59,276 KB |
| 実行使用メモリ | 10,148 KB |
| 最終ジャッジ日時 | 2024-09-13 15:32:28 |
| 合計ジャッジ時間 | 7,110 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 TLE * 1 -- * 17 |
ソースコード
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int N,W[101],dp[100][100],d=0;
void func(int l,int r,int sum){
if(sum==N){
if(l==r){
d=1;
return;
}
return;
}
func(l+W[sum],r,sum+1);
func(l,r+W[sum],sum+1);
}
int main(){
cin>>N;
for(int i=0;i<N;i++){
cin>>W[i];
}
func(0,0,0);
if(d==1){
cout<<"possible"<<endl;
}
if(d==0){
cout<<"impossible"<<endl;
}
return 0;
}
HMSR73