답안 #752576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752576 2023-06-03T08:49:04 Z penguin133 컴퓨터 네트워크 (BOI14_network) C++17
100 / 100
96 ms 4972 KB
        #include <bits/stdc++.h>
        using namespace std;
         
        //#define int long long
        #include "network.h"
        #define pi pair<int, int>
        #define pii pair<int, pi>
        #define fi first
        #define se second
        #ifdef _WIN32
        #define getchar_unlocked _getchar_nolock
        #endif
        mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
         
        vector <int> tmp[10005];
         
        void findRoute (int N, int a, int b)
        {
        	int hi;
            for(int i=1;i<=N;i++){
              if(i == b)continue;
        		int x = ping(i, b);
              
        		if(i == a)hi = x;
        		else tmp[x].push_back(i);
        	}
        	int cur = a;
        	while(hi){
        		for(auto i : tmp[hi-1]){
        			if(ping(cur, i) == 0){
        				travelTo(i);
        				cur = i;
        				hi--;
        				break;
        			}
        		}
        	}
          travelTo(b);
        }

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:21:15: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   21 |               if(i == b)continue;
      |               ^~
network.cpp:22:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   22 |           int x = ping(i, b);
      |           ^~~
network.cpp:19:14: warning: 'hi' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |          int hi;
      |              ^~
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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 4492 KB Output is correct
2 Correct 85 ms 4860 KB Output is correct
3 Correct 75 ms 4808 KB Output is correct
4 Correct 70 ms 4812 KB Output is correct
5 Correct 74 ms 4776 KB Output is correct
6 Correct 78 ms 4844 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 596 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 4468 KB Output is correct
2 Correct 19 ms 2900 KB Output is correct
3 Correct 90 ms 4892 KB Output is correct
4 Correct 69 ms 4768 KB Output is correct
5 Correct 77 ms 4856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4404 KB Output is correct
2 Correct 20 ms 2880 KB Output is correct
3 Correct 96 ms 4972 KB Output is correct
4 Correct 83 ms 4780 KB Output is correct
5 Correct 77 ms 4872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 4484 KB Output is correct
2 Correct 20 ms 2892 KB Output is correct
3 Correct 84 ms 4832 KB Output is correct
4 Correct 73 ms 4516 KB Output is correct
5 Correct 72 ms 4520 KB Output is correct