Submission #41128

# Submission time Handle Problem Language Result Execution time Memory
41128 2018-02-13T04:13:41 Z 14kg Computer Network (BOI14_network) C++11
100 / 100
150 ms 58656 KB
#include "network.h"
#include <algorithm>

using namespace std;
int out_len, d_len, out[1001];
pair<int,int> d[1001];

void findRoute(int n, int s, int e){
    int out_w;

    out_len=ping(s,e)+1;
    out_w=out_len-1, out[out_w+1]=e;

    for(int i=1; i<=n; i++)
        if(i!=s && i!=e) d[++d_len]={ping(s,i),i};

    sort(d+1,d+d_len+1);
    for(int i=d_len; i>=1; i--){
        if(out_w<=d[i].first) continue;
        if(d[i].first+ping(d[i].second,out[out_w+1])==out_w-1){
            out[out_w]=d[i].second, out_w--;
        }
    }

    for(int i=1; i<=out_len; i++) travelTo(out[i]);
}

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 118 ms 7956 KB Output is correct
2 Correct 121 ms 11384 KB Output is correct
3 Correct 104 ms 14196 KB Output is correct
4 Correct 100 ms 17012 KB Output is correct
5 Correct 111 ms 19420 KB Output is correct
6 Correct 104 ms 21844 KB Output is correct
7 Correct 1 ms 21844 KB Output is correct
8 Correct 1 ms 21844 KB Output is correct
9 Correct 1 ms 21844 KB Output is correct
10 Correct 2 ms 21844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 103 ms 24396 KB Output is correct
2 Correct 33 ms 24396 KB Output is correct
3 Correct 112 ms 28636 KB Output is correct
4 Correct 98 ms 30580 KB Output is correct
5 Correct 118 ms 34396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 150 ms 36724 KB Output is correct
2 Correct 28 ms 36724 KB Output is correct
3 Correct 117 ms 40796 KB Output is correct
4 Correct 95 ms 42812 KB Output is correct
5 Correct 124 ms 46524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 48896 KB Output is correct
2 Correct 28 ms 48896 KB Output is correct
3 Correct 137 ms 52948 KB Output is correct
4 Correct 119 ms 55056 KB Output is correct
5 Correct 124 ms 58656 KB Output is correct