제출 #295106

#제출 시각아이디문제언어결과실행 시간메모리
295106AKaan37Split the Attractions (IOI19_split)C++17
컴파일 에러
0 ms0 KiB
#include "split.h" #include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define mp make_pair #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo inf = 2000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 500005; const lo mod = 1000000007; int n,m,b[li],a[li],k,flag,t,ind,mn=inf,mx,mx1,par[li],vis[li],say,gel,sub[li]; int cev; string s; vector<int> v[li]; inline void dfs(int node,int ata){ if(vis[node])return; sub[node]=1; for(int i=0;i<(int)v[node].size();i++){ int go=v[node][i]; if(go==ata)continue; if(vis[go])continue; dfs(go,node); sub[node]+=sub[go]; } par[node]=ata; if(sub[node]>=mx && sub[node]<mn){ind=node;mn=sub[node];} } inline void dfs1(int node,int ata,int aa,int bb,int cc){ if(vis[node])return; if(mx==aa && (b[1]==0 || b[1]==gel)){vis[node]=1;b[1]=gel;say++;} else if(mx==bb && (b[2]==0 || b[2]==gel)){vis[node]=2;b[2]=gel;say++;} else if(mx==cc && (b[3]==0 || b[3]==gel)){vis[node]=3;b[3]=gel;say++;} if(say>=mx)return ; for(int i=0;i<(int)v[node].size();i++){ int go=v[node][i]; if(go==ata)continue; dfs1(go,node,aa,bb,cc); } } vector<int> find_split(int n, int aa, int bb, int cc, vector<int> p, vector<int> q) { vector<int> res; a[1]=aa; a[2]=bb; a[3]=cc; sort(a+1,a+4); mx=a[2]; mx1=a[1]; for(int i=0;i<(int)p.size();i++){ v[p[i]].pb(q[i]); v[q[i]].pb(p[i]); } gel=1; ind=-1; dfs(0,-1); if(ind==-1){ FOR res.pb(0); return res; } dfs1(ind,par[ind],aa,bb,cc); mx=mx1; gel=2; say=0; mn=inf; ind=-1; dfs(0,-1); if(ind==-1){ FOR res.pb(0); return res; } dfs1(ind,par[ind],aa,bb,cc); for(int i=0;i<n;i++){ if(aa){aa--;v.pb(1);} if(bb){bb--;v.pb(2);} if(cc){cc--;v.pb(3);} } return res; }

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

split.cpp: In function 'std::vector<int> find_split(int, int, int, int, std::vector<int>, std::vector<int>)':
split.cpp:13:12: error: request for member 'push_back' in 'v', which is of non-class type 'std::vector<int> [500005]'
   13 | #define pb push_back
      |            ^~~~~~~~~
split.cpp:89:17: note: in expansion of macro 'pb'
   89 |   if(aa){aa--;v.pb(1);}
      |                 ^~
split.cpp:13:12: error: request for member 'push_back' in 'v', which is of non-class type 'std::vector<int> [500005]'
   13 | #define pb push_back
      |            ^~~~~~~~~
split.cpp:90:17: note: in expansion of macro 'pb'
   90 |   if(bb){bb--;v.pb(2);}
      |                 ^~
split.cpp:13:12: error: request for member 'push_back' in 'v', which is of non-class type 'std::vector<int> [500005]'
   13 | #define pb push_back
      |            ^~~~~~~~~
split.cpp:91:17: note: in expansion of macro 'pb'
   91 |   if(cc){cc--;v.pb(3);}
      |                 ^~