結果

問題 No.3387 23578 Sequence
コンテスト
ユーザー vjudge1
提出日時 2026-02-09 01:24:28
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 448 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,307 ms
コンパイル使用メモリ 333,284 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2026-03-11 15:36:35
合計ジャッジ時間 4,407 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'void solve()':
main.cpp:14:16: warning: '*arr.1[0]' may be used uninitialized [-Wmaybe-uninitialized]
   14 |     sum = arr[i]+arr[n-i-1];
      |           ~~~~~^
main.cpp:14:27: warning: '*arr.1[<unknown>]' may be used uninitialized [-Wmaybe-uninitialized]
   14 |     sum = arr[i]+arr[n-i-1];
      |                  ~~~~~~~~~^
main.cpp:16:34: warning: '*arr.1[<unknown>]' may be used uninitialized [-Wmaybe-uninitialized]
   16 |       int temp = arr[i]+arr[n-i-1];
      |                         ~~~~~~~~~^

ソースコード

diff #
raw source code

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


void solve(){
  int n;
  cin>>n;
  int arr[n];
  
  int sum=0;
  bool flag = true;
  for(int i=0;i<n/2;i++){
   if(i==0){
    sum = arr[i]+arr[n-i-1];
   }else{
      int temp = arr[i]+arr[n-i-1];
      if(sum!=temp)
      flag = false;
   }
  }
  if(flag)
  cout<<"Yes";
  else
  cout<<"No";
  return;
}

int main(){

  int t;
  cin>>t;

  while(t--){
    solve();
    cout<<endl;
  }

  return 0;
}
0