Submission #1310614

#TimeUsernameProblemLanguageResultExecution timeMemory
1310614chawinknComputer Network (BOI14_network)C++20
0 / 100
50 ms4264 KiB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

void findRoute (int N, int a, int b)
{
    /*
     *  Obviously, this is not a good solution.
     *  Replace it with your own code.
     */

    vector<int> distA(N+1), distB(N+1);
    vector<pair<int,int>> A;

    for (int i = 1; i <= N; i++) {
        if (a != i)
            distA[i] = ping(a, i) + 1;
        if (b != i)
            distB[i] = ping(b, i) + 1;
        A.push_back({distA[i], i});
    }

    sort(A.begin(), A.end());

    int cur=0;
    for (auto [d, i] : A) {
        cout << d << " " << i << " " << d+distB[i] << " " << distA[b] << "\n";
        if (d+distB[i] == distA[b] && d == cur+1) {
            travelTo(i);
            cur++;
        }
    }
}

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...