func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, ans[1009], t, l, r, low = 1e8, vis[1009];   vector<pair<int, int> > v0, v1;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> t >> l >> r;       if (t == 0)         v0.push_back({l, r});       else         v1.push_back({l, r});     }     sort(v0.begin(), v0.end());     sort(v1.begin(), v1.end());     for (auto i : v1) {       l = i.first, r = i.second;       int b = low;       if (ans[l] != 0)         b = ans[l];       else         low -= 4000;       while (l <= r) {         vis[l]++;         if (!ans[l]) ans[l] = b;         l++;       }     }     for (auto i : v0) {       l = i.first, r = i.second;       for (int j = l; j < r; j++) {         if (!ans[j] && !ans[j + 1]) {           ans[j] = 1000000000, ans[j + 1] = 1000000000 - 1;           break;         } else if (!ans[j]) {           ans[j] = 1 + ans[j + 1];           break;         } else if (!ans[j + 1]) {           ans[j + 1] = ans[j] - 1;           break;         }       }     }     for (int i = 1; i <= n; i++)       if (!ans[i]) ans[i] = 1;     for (auto i : v0) {       int yes = 1;       l = i.first, r = i.second;       for (int j = l; j < r; j++) {         if (ans[j] > ans[j + 1]) {           yes = 0;           break;         }       }       if (yes) return cout <<  NO , 0;     }     cout <<  YES n ;     for (int i = 1; i <= n; i++) cout << ans[i] <<    ;     return 0;   }   