| Task: | Tietoverkko |
| Sender: | okkokko |
| Submission time: | 2021-10-12 15:51:33 +0300 |
| Language: | C++ (C++11) |
| 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.61 s | 1, 2, 3 | details |
| #2 | RUNTIME ERROR | 0.01 s | 2, 3 | details |
| #3 | RUNTIME ERROR | 0.28 s | 3 | details |
Code
#include <iostream>
#include <map>
using namespace std;
using std::map;
map<int,int> *koneet;
int total = 0;
map<int,int> Crossroads(int kone,int source,int sourceSpeed) {
map<int,int> yhteydet;
yhteydet[sourceSpeed] = 1;
int addTotal = 0;
map<int,int> &ko = koneet[kone];
/*
map<int, int>::iterator itr;
for (itr=ko.begin();itr!=ko.end();++itr){
}*/
for (auto &item : ko){
if (item.first !=source){
Crossroads(item.first,kone,item.second);
}
}
total+=addTotal;
return yhteydet;
}
int main(){
int n;
cin >> n;
koneet =new map<int,int>[n];
for (int i = 0; i<n; i++){
int c0,c1,c2;
cin >> c0;
cin >> c1;
cin >> c2;
koneet[c0][c1]=c2;
koneet[c1][c0]=c2;
}
Crossroads(1,0,0);
cout << total;
return 0;
}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) |
