Task: | Tietoverkko |
Sender: | Salama |
Submission time: | 2021-10-12 19:46:24 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 10 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 10 |
#2 | TIME LIMIT EXCEEDED | 0 |
#3 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
#2 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#3 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'long long unsigned int haku(int, int, long long unsigned int)': input/code.cpp:12:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if (u.first == e) continue; ~~~~~~~~^~~~ input/code.cpp: In function 'int main()': input/code.cpp:27:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < n-1; i++) { ~~^~~~~ input/code.cpp:32:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < n-1; i++) { ~~^~~~~
Code
#include <bits/stdc++.h> using namespace std; int bl = 0; unsigned long long tc = 0; map<unsigned, map<unsigned, unsigned long long>> v; unsigned z[5], n; unsigned long long haku(int s, int e, unsigned long long maxc) { for (auto u : v[s]) { if (u.first == e) continue; tc += haku(u.first, s, min(maxc, u.second)); } return bl <= s ? maxc : 0; //cout << c[s] << "\n"; } int main () { ios_base::sync_with_stdio(0); cin.tie(0); unsigned long long a, b; unsigned long long x; cin >> n; for(int i = 0; i < n-1; i++) { cin >> a >> b >> x; v[a-1][b-1] = x; v[b-1][a-1] = x; } for(int i = 0; i < n-1; i++) { haku(i, -1, -1); bl++; } cout << tc << "\n"; }
Test details
Test 1
Group: 1, 2, 3
Verdict: ACCEPTED
input |
---|
100 1 2 74 1 3 100 2 4 50 3 5 40 ... |
correct output |
---|
88687 |
user output |
---|
88687 |
Test 2
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
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: TIME LIMIT EXCEEDED
input |
---|
200000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1080549209850010931 |
user output |
---|
(empty) |