結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
こる
|
| 提出日時 | 2017-01-04 13:08:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 600 bytes |
| コンパイル時間 | 692 ms |
| コンパイル使用メモリ | 62,948 KB |
| 実行使用メモリ | 10,144 KB |
| 最終ジャッジ日時 | 2024-12-16 11:09:25 |
| 合計ジャッジ時間 | 61,627 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 TLE * 10 |
ソースコード
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<sstream>
using namespace std;
void dfs(int index, int right, int left, int n, vector<int> w){
if (index == n){
if (right == left){
cout << "possible" << endl;
exit(0);
}return;
}
dfs(index + 1, right + w[index], left, n, w);
dfs(index + 1, right, left + w[index], n, w);
return;
}
int main(){
int n;
cin >> n;
vector<int> w;
int temp;
for (int i = 0; i < n; i++){
cin >> temp;
w.push_back(temp);
}
dfs(1, w[0], 0, n, w);
dfs(1, 0, w[0], n, w);
cout << "impossible" << endl;
return 0;
}
こる