Submission #300986

# Submission time Handle Problem Language Result Execution time Memory
300986 2020-09-17T15:41:19 Z zecookiez Computer Network (BOI14_network) C++17
50 / 100
144 ms 11768 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];
int memo[MAXN][MAXN];

int pong(int a, int b){
    if(memo[a][b] != -1) return memo[a][b];
    return memo[a][b] = memo[b][a] = ping(a, b);
}

void findRoute(int N, int a, int b){
    memset(memo, -1, sizeof(memo));
    int c = pong(a, b); dist[c].push_back(b);
    for(int v, i = 1; i <= N; ++i){
        if(i == a) continue;
        v = pong(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(pong(prev, nxt) == 0 && x + 1 + pong(nxt, b) == c){
                travelTo(nxt); prev = nxt;
                break;
            }
        }
    }
    travelTo(b);
}

Compilation message

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 Incorrect 133 ms 8312 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 117 ms 8312 KB Output is correct
2 Correct 28 ms 6264 KB Output is correct
3 Correct 135 ms 8184 KB Output is correct
4 Correct 101 ms 8184 KB Output is correct
5 Correct 134 ms 8184 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 8184 KB Output is correct
2 Correct 28 ms 6272 KB Output is correct
3 Correct 131 ms 8184 KB Output is correct
4 Correct 98 ms 8184 KB Output is correct
5 Correct 144 ms 8312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 130 ms 8184 KB Output is correct
2 Correct 28 ms 6784 KB Output is correct
3 Incorrect 137 ms 11768 KB Too many calls to ping
4 Halted 0 ms 0 KB -