Task: | Tietoverkko |
Sender: | EeliH |
Submission time: | 2021-10-06 20:06:06 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.46 s | 2, 3 | details |
#3 | RUNTIME ERROR | 0.25 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:50:9: warning: variable 'u' set but not used [-Wunused-but-set-variable] int u = 0; ^
Code
#include <algorithm> #include <iostream> #include <vector> using namespace std; vector<struct A> c; vector<int> a[200000]; bool z[200000] = {false}; struct A { int a; int b; int x; }; bool a_comp(struct A q, struct A b) { return q.x < b.x; } int maara(int q, int pois) { int m = z[q] ? 0 : 1; for(int naapuri: a[q]) { if(naapuri != pois) { m += maara(naapuri, q); } } return m; } int main() { int n; cin >> n; for(int i = 0; i < n - 1; i++) { struct A b; cin >> b.a >> b.b >> b.x; c.push_back(b); a[b.a].push_back(b.b); a[b.b].push_back(b.a); } sort(c.begin(), c.end(), a_comp); uint64_t summa = 0; int h = 0; int u = 0; for(struct A i: c) { //cout << "A: " << i.a << " " << i.b << " " << i.x << endl; //cout << maara(i.a, i.b) << endl; /*for(int naapuri: a[i.a]) { }*/ //if(u < i.x) { int r = (maara(i.a, i.b)) * i.x; if(r > 0) { summa += r; } u = i.x; z[i.a] = true; //} h++; } cout << summa << endl; }
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
100 1 2 74 1 3 100 2 4 50 3 5 40 ... |
correct output |
---|
88687 |
user output |
---|
278234 |
Test 2
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
5000 1 2 613084013 1 3 832364259 2 4 411999902 3 5 989696303 ... |
correct output |
---|
1103702320243776 |
user output |
---|
2692686401203 |
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) |