結果

問題 No.3387 23578 Sequence
コンテスト
ユーザー vjudge1
提出日時 2026-02-09 02:03:43
言語 C++17(clang)
(clang++ 21.1.8 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 630 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,086 ms
コンパイル使用メモリ 132,352 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-02-09 02:03:46
合計ジャッジ時間 2,746 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other WA * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:13:17: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
   13 |         int arr[n];
      |                 ^
main.cpp:13:17: note: read of non-const variable 'n' is not allowed in a constant expression
main.cpp:11:13: note: declared here
   11 |         int n;
      |             ^
1 warning generated.

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int test_cases;
    cin>>test_cases;

    while(test_cases>0)
    {
        int n;
        cin>>n;
        int arr[n];
        for(int i = 0 ; i<n ; i++)
        {
            cin>>arr[i];
        }
        bool flag = true;
        int sum= arr[0] + arr[n-1];
        for(int i = 0, j=n-1 ; i<n/2 ; i++,j--)
        {
            if(sum != arr[i]+ arr[j])
            flag = false;
            break;
        }


        if(flag)
        cout<<"Yes"<<endl;
        else 
        cout<<"No"<<endl;
        
        test_cases--;
    }
    
    return 0;
} 
0