# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
873094 | nskybytskyi | Restore Array (RMI19_restore) | C++17 | 392 ms | 1108 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n, m;
cin >> n >> m;
vector<vector<pair<int, int>>> graph(n + 1);
for (int v = 0; v < n; ++v) {
graph[v + 1].emplace_back(v, 0);
graph[v].emplace_back(v + 1, 1);
}
while (m--) {
int l, r, k, v;
cin >> l >> r >> k >> v;
if (v) {
graph[r + 1].emplace_back(l, k - r + l - 2);
} else {
graph[l].emplace_back(r + 1, r - l + 1 - k);
}
}
const auto inf = numeric_limits<int>::max() >> 1;
vector<int> distance(n + 1, inf);
distance[0] = 0;
bool exists = true;
for (int phase = 0; phase <= n; ++phase) {
exists = true;
for (int u = 0; u < n; ++u) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |