func_code_string: #include <bits/stdc++.h>   using namespace std;   const int next_x[8] = {0, 1, -1, 0, 1, 1, -1, -1};   const int next_y[8] = {1, 0, 0, -1, 1, -1, -1, 1};   const int inf = 1e9 + 5;   const long long linf = 1e18 + 5;   const double PI = acos(-1.0);   const int MAXN = 1e6 + 5;   const int N = 4e6 + 5;   const long double eps = 1e-8;   const long double fix = 1e-2;   int n;   int a[MAXN], b[MAXN];   int l[MAXN], r[MAXN];   int s[MAXN], h = 0;   vector<int> st[MAXN], ed[MAXN];   int cnt[MAXN];   bool flag = 1;   struct node {     int i;     bool operator<(const node &t) const { return r[i] < r[t.i]; }   };   int work() {     scanf( %d , &n);     for (int i = (1), I = (2 * n) + 1; i < I; ++i) {       char t[5];       scanf( %s , t);       if (t[0] ==  + ) continue;       scanf( %d , &a[i]);     }     for (int i = (1), I = (2 * n) + 1; i < I; ++i)       if (a[i]) {         while (h && a[i] > a[s[h]]) --h;         l[a[i]] = s[h] + 1, r[a[i]] = i - 1, s[++h] = i;       }     for (int x = (1), I = (n) + 1; x < I; ++x)       st[l[x]].push_back(x), ed[r[x]].push_back(x), flag &= (r[x] >= l[x]);     set<node> s;     for (int i = (1), I = (2 * n) + 1; i < I; ++i) {       for (auto x : st[i]) s.insert({x});       if (!a[i]) {         if (s.empty())           flag = 0;         else           b[i] = s.begin()->i, s.erase(s.begin());       }       for (auto x : ed[i])         if (s.find({x}) != s.end()) flag = 0;     }     for (int i = (1), I = (2 * n) + 1; i < I; ++i)       if (b[i]) cnt[b[i]]++;     for (int i = (1), I = (n) + 1; i < I; ++i) flag &= (cnt[i] == 1);     if (!flag) return puts( NO );     puts( YES );     for (int i = (1), I = (2 * n) + 1; i < I; ++i)       if (b[i]) printf( %d  , b[i]);     return 0;   }   int main() {     work();     return 0;   }   