제출 #1053365

#제출 시각아이디문제언어결과실행 시간메모리
1053365SzymonKrzywda경찰관과 강도 (BOI14_coprobber)C++17
16 / 100
38 ms2904 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
vector<int> graf[500];
int odl[500][500];
 
int akt_pos = 0;
 
int start(int n,bool A[][500] ){
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++){
            if (A[i][j]) graf[i].push_back(j);
        }
    }
    
    
    for (int i=0; i<n; i++){
        vector<bool> odwiedzone(n,false);
        queue<pair<int,int>> kolejka;
        
        odwiedzone[i] = true;
        kolejka.push({0,i});
        
        
        while (!kolejka.empty()){
            int v = kolejka.front().second;
            int val = kolejka.front().first;
            kolejka.pop();
            odl[i][v] = val;
            for (int s : graf[v]){
                if (!odwiedzone[s]){
                    odwiedzone[s] = true;
                    kolejka.push({val+1,s});
                }
            }
        }
        
        
    }
    
    
    
    return 0;
    
    
}
 
 
int nextMove(int R){
    
    int akt_k,akt_m=1e8;
    
    for (int s : graf[akt_pos]){
        int maxi=0;
        for (int s_2 : graf[R]){
            maxi = max(maxi,odl[s][s_2]);
        }
        
        if (maxi < akt_m){
            akt_k = s;
            akt_m = maxi;
        }
        
    }
    
    akt_pos = akt_k;
    
    return akt_k;
}

컴파일 시 표준 에러 (stderr) 메시지

coprobber.cpp: In function 'int nextMove(int)':
coprobber.cpp:69:12: warning: 'akt_k' may be used uninitialized in this function [-Wmaybe-uninitialized]
   69 |     return akt_k;
      |            ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...