제출 #163672

#제출 시각아이디문제언어결과실행 시간메모리
163672alexandra_udristoiuBosses (BOI16_bosses)C++14
0 / 100
2 ms504 KiB
#include<iostream> #include<vector> #include<cstring> #define DIM 5005 using namespace std; int n, i, j, m, x, sum, sol; int viz[DIM], niv[DIM]; vector<int> v[DIM]; void dfs(int nod){ viz[nod] = 1; sum += niv[nod]; for(int i = 0; i < v[nod].size(); i++){ int vecin = v[nod][i]; if(viz[vecin] == 0){ niv[vecin] = 1 + niv[nod]; dfs(vecin); } } } int main(){ cin>> n; for(i = 1; i <= n; i++){ cin>> m; for(j = 1; j <= m; j++){ cin>> x; v[x].push_back(i); } } sol = 1000000000; for(i = 1; i <= n; i++){ memset(viz, 0, sizeof(viz) ); niv[i] = 1; sum = 0; dfs(i); sol = min(sol, sum); } cout<< sol; }

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

bosses.cpp: In function 'void dfs(int)':
bosses.cpp:12:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < v[nod].size(); i++){
                    ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...