Submission #16779

# Submission time Handle Problem Language Result Execution time Memory
16779 2015-09-28T16:15:23 Z kdh9949 Computer Network (BOI14_network) C++
25 / 100
134 ms 5588 KB
#include "network.h"
#include <vector>
#include <stack>

using namespace std;

vector<int> d[1010];
stack<int> ans;

void findRoute (int N, int a, int b)
{
    int cur,dist,last;
    for(int i=1;i<=N;i++){
        if(i==a)continue;
        cur=ping(a,i);
        if(i==b)dist=cur;
        d[cur].push_back(i);
    }
    last=b;
    for(int i=dist-1;i>=0;i--){
        for(int j=0;j<d[i].size();j++){
            if(ping(last,d[i][j])==0){
                ans.push(last);
                last=d[i][j];
            }
        }
    }
    ans.push(last);
    while(!ans.empty())travelTo(ans.top()),ans.pop();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5588 KB Output is correct
2 Correct 112 ms 5588 KB Output is correct
3 Correct 32 ms 5588 KB Output is correct
4 Correct 134 ms 5588 KB Output is correct
5 Correct 100 ms 5588 KB Output is correct
6 Correct 107 ms 5588 KB Output is correct
7 Correct 0 ms 5588 KB Output is correct
8 Correct 0 ms 5588 KB Output is correct
9 Correct 0 ms 5588 KB Output is correct
10 Correct 0 ms 5588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 5588 KB Output isn't correct - Route is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 5588 KB Output isn't correct - Route is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 5588 KB Output isn't correct - Route is too long
2 Halted 0 ms 0 KB -