Submission #31382

# Submission time Handle Problem Language Result Execution time Memory
31382 2017-08-20T15:36:07 Z imaxblue Computer Network (BOI14_network) C++14
100 / 100
156 ms 5180 KB
#include "network.h"

#include<vector>
#include<algorithm>
using namespace std;
#define pb push_back
int d[1005], t, n;
vector<int> v[1005], ans;
int get(int i, int j){
    if (i==j) return 0;
    return ping(i, j)+1;
}
void findRoute (int N, int a, int b){
    for (int l=1; l<=N; ++l){
        v[d[l]=get(a, l)].pb(l);
    }
    n=N;
    while(b!=a){
        for(auto i:v[d[b]-1]){
            if (get(b, i)==1){
                ans.pb(b);
                b=i;
                break;
            }
        }
    }
    reverse(ans.begin(), ans.end());
    for (int l=0; l<ans.size(); ++l){
        travelTo(ans[l]);
    }
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:28:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int l=0; l<ans.size(); ++l){
                    ^
grader.c: In function 'int main()':
grader.c:48:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
                                       ^
grader.c:51:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
                                         ^
# Verdict Execution time Memory Grader output
1 Correct 156 ms 5180 KB Output is correct
2 Correct 133 ms 5180 KB Output is correct
3 Correct 109 ms 5180 KB Output is correct
4 Correct 106 ms 5180 KB Output is correct
5 Correct 143 ms 5180 KB Output is correct
6 Correct 99 ms 5180 KB Output is correct
7 Correct 0 ms 5180 KB Output is correct
8 Correct 0 ms 5180 KB Output is correct
9 Correct 0 ms 5180 KB Output is correct
10 Correct 0 ms 5180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 119 ms 5180 KB Output is correct
2 Correct 26 ms 5180 KB Output is correct
3 Correct 116 ms 5180 KB Output is correct
4 Correct 89 ms 5180 KB Output is correct
5 Correct 106 ms 5180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 116 ms 5180 KB Output is correct
2 Correct 33 ms 5180 KB Output is correct
3 Correct 129 ms 5180 KB Output is correct
4 Correct 106 ms 5180 KB Output is correct
5 Correct 109 ms 5180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 5180 KB Output is correct
2 Correct 23 ms 5180 KB Output is correct
3 Correct 109 ms 5180 KB Output is correct
4 Correct 119 ms 5180 KB Output is correct
5 Correct 116 ms 5180 KB Output is correct