제출 #1082269

#제출 시각아이디문제언어결과실행 시간메모리
1082269BlueGlaucus1Bosses (BOI16_bosses)C++17
0 / 100
1 ms348 KiB
#include <iostream> #include <vector> #include <queue> using namespace std; bool visited[5001]; int levels[5001]; vector<int> vw[5001]; int main(){ int n; cin >> n; int val = 0; for(int i =1; i <=n;i++){ val++; int a; cin >> a; for(int l =0; l <a;l++){ int k; cin >> k; vw[k].push_back(val); } } int answer=10000000; queue<int> a; for(int i = 1; i <=n;i++){ int temp = 1; fill(visited, visited+n+1, 0); fill(levels, levels+n+1, 0); a.push(i); levels[i] = 1; visited[i] = true; while(!a.empty()){ int f = a.front(); a.pop(); for(int i = 0; i <vw[f].size();i++){ int va= vw[f][i]; if(!visited[va]){ temp +=levels[f]+1; levels[va] = levels[f] + 1; visited[va] = 1; a.push(va); } } } for(int i =1; i <=n;i++){ if(!visited[i]){ continue; } } answer = min(answer, temp); } cout << answer; }

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

bosses.cpp: In function 'int main()':
bosses.cpp:33:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |             for(int i = 0; i <vw[f].size();i++){
      |                            ~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...