結果

問題 No.2343 (l+r)/2
ユーザー ytqm3ytqm3
提出日時 2023-06-03 13:46:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 685 bytes
コンパイル時間 1,991 ms
コンパイル使用メモリ 202,188 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-28 07:49:44
合計ジャッジ時間 6,368 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,760 KB
testcase_01 AC 327 ms
4,376 KB
testcase_02 AC 447 ms
4,376 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

int solve(int m, vector< int > A) {
  int N = A.size();
  if (N == 1) {
    return (A[0]==(1<<(m-1)));
  }
  int res = 0;
  for (int i = 0; i < N - 1; ++i) {
    vector< int > B(N - 1);
    for (int j = 0; j < i; ++j) {
      B[j] = A[j];
    }
    B[i] = (A[i] + A[i + 1]) / 2;
    for (int j = i + 2; j < N; ++j) {
      B[j - 1] = A[j];
    }
    res |= solve(m, B);
    if(res==1){ break; }
  }
  return res;
}

void sub(){
  int N;
  cin >> N;
  vector< int > A(N);
  for (auto& v : A) {
    cin >> v;
    v *= (1 << N);
  }
  cout<<(solve(N, A) ? "Yes" : "No")<<endl;
}

int main(){
  int T;
  cin>>T;
  while(T--){
    sub();
  }
}
0