제출 #291089

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2910892020-09-04 16:27:04TadijaSebez즐거운 행로 (APIO20_fun)C++11
컴파일 에러
0 ms0 KiB
#include "fun.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
int SUB(int root,int x){return attractionsBehind(root,x);}
int DEP(int root,int x){return hoursRequired(root,x);}
const int N=100050;
int sz[N],type[N],dist[N];
vector<pii> v[3];
vector<int> createFunTour(int n,int q){
for(int i=0;i<n;i++)sz[i]=SUB(0,i);
int cen=0;
for(int i=1;i<n;i++)if(sz[i]*2>=n&&sz[i]<sz[cen])cen=i;
type[cen]=-1;
for(int i=0,cnt=0;i<n;i++){
dist[i]=DEP(cen,i);
if(dist[i]==1&&cnt<2&&sz[i]<sz[cen]){
cnt++;
for(int j=0;j<n;j++)if(!type[j]){
if(SUB(j,i)*2>n)type[j]=cnt;
}
}
}
for(int i=0;i<n;i++)if(type[i]==0)type[i]=3;
for(int i=0;i<n;i++)if(i!=cen)v[type[i]-1].pb({dist[i],i});
if(v[0].size()<v[1].size())swap(v[0],v[1]);
if(v[0].size()<v[2].size())swap(v[0],v[2]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

fun.cpp: In function 'std::vector<int> createFunTour(int, int)':
fun.cpp:50:21: error: 'l' was not declared in this scope
   50 |  if(v[mx].size()==v[l].size()+v[r].size()&&v[mx].size()){
      |                     ^
fun.cpp:50:33: error: 'r' was not declared in this scope
   50 |  if(v[mx].size()==v[l].size()+v[r].size()&&v[mx].size()){
      |                                 ^