Submission #16366

# Submission time Handle Problem Language Result Execution time Memory
16366 2015-08-21T15:37:00 Z suhgyuho_william Computer Network (BOI14_network) C++
0 / 100
143 ms 5200 KB
#include "network.h"
#include <map>
using namespace std;

map<int,int> path;
map<int,int>::iterator it;

void findRoute (int n, int a, int b)
{
    /*
     *  Obviously, this is not a good solution.
     *  Replace it with your own code.
     */

    int dist = ping(a, b);
    int x,y;

    path[dist+1]=b;
    int i;
    for(i=1;i<=n;i++){
        if(i==a || i==b) continue;
        x=ping(a,i);
        if(path.find(x+1)!=path.end()) continue;
        path[x+1]=i;
        it=path.find(x+1);
        it++;
        y=ping(i,it->second);
        if(it->first != x+y+2){
            path.erase(x+1);
        }
    }
    for(it=path.begin(); it!=path.end(); it++){
        travelTo(it->second);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 143 ms 5200 KB Output is correct
2 Incorrect 121 ms 5200 KB Output isn't correct - ping called with invalid arguments
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 82 ms 5200 KB Output isn't correct - Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 5200 KB Output isn't correct - Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 5200 KB Output isn't correct - Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -