题意 给你n长度的数组 每个数必须填 1 - 200 满足
1 a[1] <= a[2]
2 a[i]<=max(a[i-1],a[i+1])
3 a[n-1]>=a[n]
做法 我们定义dp数组为 dp[100005][200][3]
最后一维3中的 0 代表前面的数小于当前数的个数
1 代表前面的数等于当前数的个数
2 代表前面的数大于当前数的个数
然后主要是用了滚动数组降了一维
所以时间复杂度是 n*200的
/*
if you can't see the repay
Why not just work step by step
rubbish is relaxed
to ljq
*/
#include <cstdio>
#include <cstring>
#include <iostream>
#include <queue>
#include <cmath>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <algorithm>
using namespace std;
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
typedef pair<int,int> pll;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const ll _INF = 0xc0c0c0c0c0c0c0c0;
const ll mod = (int)1e9+7;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll ksm(ll a,ll b,ll mod){int ans=1;while(b){if(b&1) ans=(ans*a)%mod;a=(a*a)%mod;b>>=1;}return ans;}
ll inv2(ll a,ll mod){return ksm(a,mod-2,mod);}
#define MOD 998244353
const int MAX_N = 100025;
int arr[MAX_N];
ll dp[MAX_N][205][3];
int main()
{
//ios::sync_with_stdio(false);
//freopen("a.txt","r",stdin);
//freopen("b.txt","w",stdout);
int n;
scanf("%d",&n);
for(int i = 1;i<=n;++i) scanf("%d",&arr[i]);
if(arr[1]!=-1) dp[1][arr[1]][0] = 1;
else
{
for(int i = 1;i<=200;++i)
dp[1][i][0] = 1;
}
ll sum = 0,ans = 0;
for(int i = 2;i<=n;++i)
{
sum = 0;
for(int j = 1;j<=200;j++)
{
if(arr[i]==-1||j==arr[i])
dp[i][j][0] = sum;
sum = (sum+dp[i-1][j][0]+dp[i-1][j][1]+dp[i-1][j][2])%MOD;
}
sum = 0;
for(int j = 1;j<=200;++j)
{
if(arr[i]==-1||j==arr[i])
dp[i][j][1] = (dp[i-1][j][0]+dp[i-1][j][1]+dp[i-1][j][2])%MOD;
}
for(int j = 200;j>=1;j--)
{
if(arr[i]==-1||j==arr[i])
dp[i][j][2] = sum;
sum = (sum+dp[i-1][j][1] + dp[i-1][j][2])%MOD;
}
}
for(int i = 1;i<=200;++i)
ans=(ans+dp[n][i][1]+dp[n][i][2])%MOD;
printf("%lld\n",ans);
//fclose(stdin);
//fclose(stdout);
//cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
return 0;
}