제출 #697464

#제출 시각아이디문제언어결과실행 시간메모리
697464Deepesson친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define MAX 1005 std::vector<int> con[MAX]; // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i=1;i!=n;++i){ if(protocol[i]==0){ int alfa = host[i]; con[alfa].push_back(i); con[i].push_back(alfa); }else { for(auto&x:con[host[alfa]]){ con[i].push_back(x); con[x].push_back(i); } } } bool foi[n]={}; int cor[n]={}; int ans=0; for(int i=0;i!=n;++i){ if(foi[i])continue; std::queue<int> queue; queue.push(i); foi[i]=true; int alfa=0,beta=0; while(queue.size()){ auto __ = queue.front(); queue.pop(); for(auto&x:con[__]){ if(foi[x])continue; if(!cor[__])++alfa;else ++beta; cor[x]=!cor[__]; queue.push(x); foi[x]=true; } } ans+=std::max(alfa,beta); } return ans; }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:12:33: error: 'alfa' was not declared in this scope
   12 |             for(auto&x:con[host[alfa]]){
      |                                 ^~~~