結果

問題 No.3387 23578 Sequence
コンテスト
ユーザー vjudge1
提出日時 2026-02-09 01:24:28
言語 C++17(gcc13)
(gcc 13.4.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 448 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,928 ms
コンパイル使用メモリ 195,968 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-02-09 01:24:32
合計ジャッジ時間 3,569 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:14:16: 警告: ‘*arr[0]’ may be used uninitialized [-Wmaybe-uninitialized]
   14 |     sum = arr[i]+arr[n-i-1];
      |           ~~~~~^
main.cpp:14:27: 警告: ‘*arr[<不明>]’ may be used uninitialized [-Wmaybe-uninitialized]
   14 |     sum = arr[i]+arr[n-i-1];
      |                  ~~~~~~~~~^
main.cpp:16:34: 警告: ‘*arr[<不明>]’ 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