Submission #34550

# Submission time Handle Problem Language Result Execution time Memory
34550 2017-11-12T10:39:56 Z Extazy Computer Network (BOI14_network) C++14
0 / 100
116 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;
    }

    bool f=false;

    for(i=2;i<=path_sz;i++) if(da[i]+db[i]==da[i-1]+db[i-1]) f=true;

    if(f==false) { //Subtask 1
        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 Incorrect 116 ms 6016 KB Message has not reached its target
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 93 ms 6016 KB Message has not reached its target
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 6016 KB Message has not reached its target
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 109 ms 6016 KB Message has not reached its target
2 Halted 0 ms 0 KB -