Submission #42603

# Submission time Handle Problem Language Result Execution time Memory
42603 2018-02-28T20:15:25 Z Hassoony Computer Network (BOI14_network) C++14
100 / 100
162 ms 58832 KB
#include<bits/stdc++.h>
#define S second
#define F first
using namespace std;

#include "network.h"
int l;
vector<pair<int,int> >v;
vector<int>ans;
void findRoute(int n,int a,int b){
    v.push_back({0,a});
    for(int i=1;i<=n;i++){
        if(i==a)continue;
        v.push_back({ping(a,i),i});
    }
    sort(v.begin(),v.end());
    while(v.back().S!=b)v.pop_back();
    l=v.size()-1;
    ans.push_back(b);
    for(int i=v.size()-2;i>=0;i--){
        int dis=ping(v[i].S,v[l].S);
        if(dis+v[i].F==v[l].F-1){
            l=i;
            ans.push_back(v[i].S);
        }
    }
    reverse(ans.begin(),ans.end());
    for(auto pp:ans)travelTo(pp);
}

Compilation message

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 time Memory Grader output
1 Correct 117 ms 8020 KB Output is correct
2 Correct 112 ms 11272 KB Output is correct
3 Correct 98 ms 14152 KB Output is correct
4 Correct 104 ms 17048 KB Output is correct
5 Correct 100 ms 19572 KB Output is correct
6 Correct 98 ms 22008 KB Output is correct
7 Correct 1 ms 22008 KB Output is correct
8 Correct 1 ms 22008 KB Output is correct
9 Correct 1 ms 22008 KB Output is correct
10 Correct 2 ms 22008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 105 ms 24656 KB Output is correct
2 Correct 25 ms 24656 KB Output is correct
3 Correct 123 ms 28712 KB Output is correct
4 Correct 90 ms 30824 KB Output is correct
5 Correct 116 ms 34396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 102 ms 36912 KB Output is correct
2 Correct 25 ms 36912 KB Output is correct
3 Correct 112 ms 41088 KB Output is correct
4 Correct 89 ms 43000 KB Output is correct
5 Correct 134 ms 46624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 49160 KB Output is correct
2 Correct 26 ms 49160 KB Output is correct
3 Correct 162 ms 53172 KB Output is correct
4 Correct 89 ms 55212 KB Output is correct
5 Correct 120 ms 58832 KB Output is correct