Submission #24322

#TimeUsernameProblemLanguageResultExecution timeMemory
24322BruteforcemanComputer Network (BOI14_network)C++11
100 / 100
156 ms6188 KiB
#include "network.h" #include "bits/stdc++.h" using namespace std; vector <int> g[2000]; map <pair <int, int>, int> mem; int dist(int x, int y) { if(x > y) swap(x, y); if(x == y) return 0; if(mem.find(make_pair(x, y)) == mem.end()) return mem[make_pair(x, y)] = ping(x, y) + 1; else return mem[make_pair(x, y)]; } void findRoute (int N, int a, int b) { for(int i = 1; i <= N; i++) { g[dist(a, i)].push_back(i); } vector <int> rout; rout.push_back(b); for(int i = dist(a, b)-1; i >= 1; i--) { for(auto j : g[i]) { if(dist(j, rout.back()) == 1) { rout.push_back(j); break; } } } reverse(rout.begin(), rout.end()); for(auto i : rout) { travelTo(i); } }

Compilation message (stderr)

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