Task: | Tietoverkko |
Sender: | Salama |
Submission time: | 2021-10-04 15:53:03 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.01 s | 1, 2, 3 | details |
#2 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
#3 | RUNTIME ERROR | 0.01 s | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; int c = 0; pair<vector<int>, int> v[10]; //200000 int z[10]; int haku(int s, int t, int smol) { if (abs(z[s]) == abs(t)) return 0; if(z[s] < 0) z[s] = -t; else z[s] = t; for (auto u: v[s].first) { if(smol == 1000000001) haku(u, t, min(smol, v[s].second)); else haku(u, t, min(smol, v[u].second)); } if(s+1 == t) smol=v[s].second; if(smol == 1000000001 || z[s] < 0) return 1; c += smol; return 1; } int main () { ios_base::sync_with_stdio(0); cin.tie(0); int n, a, b, x; cin >> n; for(int i = 0; i < n-1; i++) { cin >> a >> b >> x; v[i].first.push_back(a-1); v[i].first.push_back(b-1); v[i].second = x; } haku(0, 1, 1000000001); cout << c; }
Test details
Test 1
Group: 1, 2, 3
Verdict: RUNTIME ERROR
input |
---|
100 1 2 74 1 3 100 2 4 50 3 5 40 ... |
correct output |
---|
88687 |
user output |
---|
(empty) |
Test 2
Group: 2, 3
Verdict: RUNTIME ERROR
input |
---|
5000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1103702320243776 |
user output |
---|
(empty) |
Test 3
Group: 3
Verdict: RUNTIME ERROR
input |
---|
200000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1080549209850010931 |
user output |
---|
(empty) |