# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
610967 | penguinhacker | Robot (JOI21_ho_t4) | C++17 | 3051 ms | 50096 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;
#define ll long long
#define ar array
const int mxN=1e5;
const ll INF=1e18;
int n, m;
ll dp1[mxN]; // no change of edges leading to this node
vector<ll> dp2[mxN]; // changed the edge leading into this node
vector<ar<int, 4>> adj[mxN];
map<int, ll> mp[mxN];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i=0; i<m; ++i) {
int u, v, c, w;
cin >> u >> v >> c >> w, --u, --v;
int s1=adj[u].size(), s2=adj[v].size();
adj[u].push_back({v, c, w, s2});
adj[v].push_back({u, c, w, s1});
mp[u][c]+=w;
mp[v][c]+=w;
}
if (adj[n-1].empty()) {
cout << -1;
return 0;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |