| 16250 | 2025-04-16 17:22:45 | algopro | Két csoport | cpp17 | Forditási hiba |
// UUID: 3ed35225-7973-49c7-98ae-7f483f3c4e86
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin>>n;
vector<vector<int>> ellensegek(n+1);
vectony(n+1);
vector<bool> csop(n+1);
for(int i=1; i<=n; ++i)
{
int x; cin>>x;
while(x!=0)
{
ellensegek[i].push_back(x);
hany[i]++;
cin>>x;
}
}
queue<int> rosszak;
for(int i=1; i<=n; ++i) if(hany[i]>1) rosszak.push(i);
while(!rosszak.empty())
{
int v=rosszak.front();
rosszak.pop();
for(int x:ellensegek[v])
{
if(csop[x]!=csop[v]) hany[x]++;
else hany[x]--;
if(hany[x]>1) rosszak.push(x);
}
csop[v]=!csop[v];
}
cout<<count(csop.begin(), csop.end(), 1)<<endl;
for(int i=1; i<=n; ++i) if(csop[i]) cout<<i<<' ';
}open /var/local/lib/isolate/404/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:8:9: error: 'vectony' was not declared in this scope
8 | vectony(n+1);
| ^~~~~~~
main.cpp:16:25: error: 'hany' was not declared in this scope
16 | hany[i]++;
| ^~~~
main.cpp:21:36: error: 'hany' was not declared in this scope
21 | for(int i=1; i<=n; ++i) if(hany[i]>1) rosszak.push(i);
| ^~~~
main.cpp:28:46: error: 'hany' was not declared in this scope
28 | if(csop[x]!=csop[v]) hany[x]++;
| ^~~~
main.cpp:29:30: error: 'hany' was not declared in this scope
29 | else hany[x]--;
| ^~~~
main.cpp:30:28: error: 'hany' was not declared in this scope
30 | if(hany[x]>1) rosszak.push(x);
| ^~~~