func_code_string: #include <bits/stdc++.h>   using namespace std;   int F(int d);   int G(int d);   int n, ara[2 * 100010], dpf[2 * 100010], dpg[2 * 100010], k;   bool visf[2 * 100010], visg[2 * 100010];   vector<int> vec;   int add(int _a, int _b) {     _a = (_a + 998244353) % 998244353;     _b = (_b + 998244353) % 998244353;     return (_a + _b) % 998244353;   }   int mul(int _a, int _b) {     _a = (_a + 998244353) % 998244353;     _b = (_b + 998244353) % 998244353;     return ((long long int)((long long int)_a * (long long int)_b)) % 998244353;   }   void input() {     int i, j;     scanf( %d %d , &n, &k);     for (i = 0; i < n; i++) {       scanf( %d , &ara[i]);     }   }   int G(int d) {     int i, j;     if (d == 0) {       return 1;     }     if (visg[d]) {       return dpg[d];     }     visg[d] = true;     int s1 = 0, s2 = 0;     s1 = F(d - 1) % 998244353;     s2 = mul(max(k - 2, 0), G(d - 1) % 998244353);     return dpg[d] = add(s1, s2);   }   int F(int d) {     int i, j;     if (d == 0) {       return 0;     }     if (visf[d]) {       return dpf[d];     }     visf[d] = true;     return dpf[d] = mul(k - 1, G(d - 1) % 998244353);   }   int sol(int f) {     int i, j, cnt, ret = 1, s;     for (i = 0, vec.clear(); i < n; i++) {       if (i % 2 == f) {         vec.push_back(ara[i]);       }     }     for (i = 0; i < vec.size(); i = j) {       int respect = vec[i];       for (j = i + 1, cnt = 0; j < vec.size() && vec[j] == -1; j++) {         cnt++;       }       if (j == vec.size()) {         if (respect == -1) {           for (j = 0; j < vec.size(); j++) {             if (j == 0) {               ret = mul(ret, k);             } else {               ret = mul(ret, k - 1);             }           }         } else {           if (cnt == 0) {             ret = mul(ret, 1);           } else {             s = add(F(cnt - 1) % 998244353, mul(k - 1, G(cnt - 1) % 998244353));             ret = mul(ret, s);           }         }       } else {         if (respect == -1) {           s = add(F(cnt) % 998244353, mul(k - 1, G(cnt) % 998244353));           ret = mul(ret, s);         } else if (respect == vec[j]) {           ret = mul(ret, F(cnt) % 998244353);         } else {           ret = mul(ret, G(cnt) % 998244353);         }       }     }     return ret;   }   void solve() {     int i, j;     int ret = mul(sol(0), sol(1));     printf( %d , ret);     puts(  );   }   int main() {     input();     solve();   }   