Submission #426696

#TimeUsernameProblemLanguageResultExecution timeMemory
426696snasibov05RMQ (NOI17_rmq)C++14
23 / 100
1097 ms284 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; #define oo 1000000000 struct range{ int l, r; int val; }; int main() { int n, q; cin >> n >> q; vector<range> v(q); for (int i = 0; i < q; ++i) { cin >> v[i].l >> v[i].r >> v[i].val; } vector<int> ans(n, -1); vector<int> p(n); for (int i = 0; i < n; ++i) { p[i] = i; } do{ bool flag = true; for (int i = 0; i < q; ++i) { int mn = oo; for (int j = v[i].l; j <= v[i].r; ++j) { mn = min(mn, p[j]); } if (mn != v[i].val) flag = false; } if (flag) ans = p; } while (next_permutation(p.begin(), p.end())); for (auto x : ans) cout << x << " "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...