Submission #34548

# Submission time Handle Problem Language Result Execution time Memory
34548 2017-11-12T10:15:52 Z Extazy Computer Network (BOI14_network) C++14
25 / 100
129 ms 6016 KB
#include <bits/stdc++.h>
#include "network.h"

#define endl '\n'

using namespace std;

const int N = 1024;

int n,a,b;
int da[N],db[N];
int min_dist;
int shortest,path[N],path_sz;

/*void travelTo(int x) {
}

int ping(int a, int b) {
    
}*/

int ask(int a, int b) {
    if(a==b) return 0;
    return 1+ping(a,b);
}

bool cmp(int a, int b) {
    return da[a]<da[b];
}

void findRoute(int N, int A, int B) {
    int i;
    
    n=N;
    a=A;
    b=B;

    shortest=ask(a,b);
    da[a]=0;
    da[b]=shortest;
    db[a]=shortest;
    db[b]=0;
    path_sz=0;

    for(i=1;i<=n;i++) if(i!=A && i!=B) {
        da[i]=ask(a,i);
        db[i]=ask(b,i);
        if(da[i]+db[i]==shortest) path[++path_sz]=i;
    }

    sort(path+1,path+1+path_sz,cmp);
    for(i=1;i<=path_sz;i++) travelTo(path[i]);
    travelTo(b);
}

/*int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    return 0;
}*/

Compilation message

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 113 ms 6016 KB Output is correct
2 Correct 109 ms 6016 KB Output is correct
3 Correct 106 ms 6016 KB Output is correct
4 Correct 103 ms 6016 KB Output is correct
5 Correct 129 ms 6016 KB Output is correct
6 Correct 116 ms 6016 KB Output is correct
7 Correct 0 ms 6016 KB Output is correct
8 Correct 0 ms 6016 KB Output is correct
9 Correct 0 ms 6016 KB Output is correct
10 Correct 0 ms 6016 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 6016 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 6016 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 6016 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -