Submission #300974

# Submission time Handle Problem Language Result Execution time Memory
300974 2020-09-17T15:35:14 Z zecookiez Computer Network (BOI14_network) C++17
25 / 100
134 ms 8184 KB
#include <bits/stdc++.h>
#include <network.h>
using namespace std;
template<class C>constexpr int len(const C&c){return int(c.size());}

const int MAXN = 1001;
vector<int> dist[MAXN];

void findRoute(int N, int a, int b){
    int c = ping(a, b); dist[c].push_back(b);
    for(int v, i = 1; i <= N; ++i){
        if(i == a) continue;
        v = i == b ? c : ping(a, i);
        if(v < c) dist[v].push_back(i);
    }
    int prev = a;
    for(int x = 0; x < c; ++x){
        for(int nxt : dist[x]){
            if(x + 1 + ping(nxt, b) == c){
                travelTo(nxt); prev = nxt;
                break;
            }
        }
    }
    travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:16:9: warning: variable 'prev' set but not used [-Wunused-but-set-variable]
   16 |     int prev = a;
      |         ^~~~
grader.c: In function 'int main()':
grader.c:48:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   48 |     scanf ("%d%d%d%d", &N, &a, &b, &M);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader.c:51:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   51 |             scanf("%d", &distance[u][v]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 134 ms 8184 KB Output is correct
2 Correct 131 ms 7744 KB Output is correct
3 Correct 119 ms 7160 KB Output is correct
4 Correct 117 ms 7032 KB Output is correct
5 Correct 118 ms 6776 KB Output is correct
6 Correct 118 ms 6720 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 6776 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 120 ms 6776 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 6904 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -