結果

問題 No.1741 Arrays and XOR Procedure
ユーザー monkukui2monkukui2
提出日時 2021-11-12 22:10:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 2,084 bytes
コンパイル時間 2,709 ms
コンパイル使用メモリ 158,020 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-25 18:57:54
合計ジャッジ時間 4,578 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "atcoder/all"
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>
#include <cstddef>
#include <type_traits>
#include <vector>

using namespace std;
const long long int INF = numeric_limits<long long int>::max() / 4;
const int inf = numeric_limits<int>::max() / 4;
const long long int MOD1000000007 = 1000000007;
const long long int MOD998244353 = 998244353;
const double MATH_PI = 3.1415926535897932;

template<typename T1, typename T2>
inline void chmin(T1 &a, const T2 &b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, const T2 &b) { if (a < b) a = b; }

#define lint long long int
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define VI vector<int>
#define VLL vector<long long>
#define VC vector<char>
#define VB vector<bool>
#define PI pair<int, int>
#define PLL pair<long long, long long>
#define VPI vector<pair<int, int>>
#define VPLL vector<pair<long long, long long>>
#define VVI vector<vector<int>>
#define VVPI vecor<vector<pair<int, int>>>
#define VVPILL vector<vector<pair<int, long long>>>

#define SUM(v) accumulate(ALL(v), 0LL)
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))

using mint = atcoder::modint998244353;

int main() {

    int n; cin >> n;
    vector<int> a(n);
    lint cnt = 0;
    rep (i, n) {
        cin >> a[i];
        cnt += a[i] == -1;
    }

    int f = a.front();
    int b = a.back();
    if (f == 1 and b == 1) {
        cout << 0 << endl;
        return 0;
    }
    if (f == 0 and b == 0) {
        cout << 0 << endl;
        return 0;
    }

    if (f == -1 or b == -1) {
        cnt--;
    }
    cout << mint(2).pow(cnt).val() << endl;
    return 0;
}
0