Submission #16044

#TimeUsernameProblemLanguageResultExecution timeMemory
16044kaTkaHrComputer Network (BOI14_network)C++98
Compilation error
0 ms0 KiB
#include "network.h" #include<vector> using namespace std; const int MX = 1005; vector<int> G[MX]; void findRoute (int N, int a, int b) { int D = ping(a, b) + 1; for (int i = 1; i <= N; i++){ if (i == b) G[0].push_back(b); else if( i != a ) G[ping(b, i) + 1].push_back(i); else G[D].push_back(i); } int nw = a; for (int i = 1;; i++){ int nxt = -1; for (int c : G[D-i]){ if (ping(nw, c) == 0){ nxt = c; if (nxt == b){ travelTo(nxt); return; } } } nw = nxt; travelTo(nxt); } }

Compilation message (stderr)

network.cpp: In function ‘void findRoute(int, int, int)’:
network.cpp:21:16: error: range-based ‘for’ loops are not allowed in C++98 mode
   for (int c : G[D-i]){
                ^
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]);
                                         ^