func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, a[1000006], ans[1000006];   bool b[1000006];   stack<pair<int, int> > s1, s2;   int main() {     int i, j;     scanf( %d , &n);     for (i = 1; i <= n; i++) scanf( %d , &a[i]);     scanf( %d , &m);     for (i = 1; i <= m; i++) {       scanf( %d , &j);       b[j] = true;     }     for (i = 1; i <= n; i++) {       if (b[i]) {         while (s1.size()) {           if (s1.top().first == a[i] && s2.size() == 0) {             break;           } else if (s2.size() && s1.top().first == s2.top().first) {             ans[s1.top().second] = 1;             ans[s2.top().second] = -1;             s1.pop();             s2.pop();           } else {             s2.push(s1.top());             s1.pop();           }         }         if (s1.size() == 0) return cout <<  NO  << endl, 0;         ans[s1.top().second] = 1;         ans[i] = -1;         s1.pop();       } else {         s1.push({a[i], i});       }     }     while (s1.size()) {       if (s2.size() == 0) {         s2.push(s1.top());         s1.pop();       } else if (s1.top().first == s2.top().first) {         ans[s1.top().second] = 1;         ans[s2.top().second] = -1;         s1.pop();         s2.pop();       } else {         s2.push(s1.top());         s1.pop();       }     }     if (s2.size()) return cout <<  NO  << endl, 0;     printf( YES n );     for (i = 1; i <= n; i++) printf( %d  , a[i] * ans[i]);   }   