Submission #1327670

#TimeUsernameProblemLanguageResultExecution timeMemory
1327670aren_danceComputer Network (BOI14_network)C++20
Compilation error
0 ms0 KiB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;
void findRoute(int n,int a,int b){
  int d=ping(a,b);
  vector<pair<int,int>> u;
  for(int i=1;i<=n;++i){
    if(i==a)
    continue;
    if(i==b)
    continue;
    int x=ping(a,i);
    int y=ping(b,i);
    if(x+y==d-1){
      u.push_back({x,i});
    }
  }
  sort(u.begin(),u.end());
  if(u.empty()){
    travelTo(b);
  }
  for(int i=0;i<int(u.size());++i){
      //if(ping(cur,u[i].second)==0){
        cur=u[i].second;
        travelTo(cur);
        cnt++;
    }
  }
  travelTo(b);
}

Compilation message (stderr)

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:24:9: error: 'cur' was not declared in this scope
   24 |         cur=u[i].second;
      |         ^~~
network.cpp:26:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
   26 |         cnt++;
      |         ^~~
      |         int
network.cpp: At global scope:
network.cpp:29:11: error: expected constructor, destructor, or type conversion before '(' token
   29 |   travelTo(b);
      |           ^
network.cpp:30:1: error: expected declaration before '}' token
   30 | }
      | ^
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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~