| 25511 | 2026-02-20 13:13:06 | Kevin | Sportos nyaralás | csharp | Forditási hiba |
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll, ll>;
vector<ll> bicikli, kajak;
ll rootB(ll x){
if (bicikli[x]==x) return x;
bicikli[x]=rootB(bicikli[x]);
return bicikli[x];
}
ll rootK(ll x){
if (kajak[x]==x) return x;
kajak[x]=rootK(kajak[x]);
return kajak[x];
}
void unioB(ll a, ll b){
a=rootB(a); b=rootB(b);
if (a>b) swap(a, b);
bicikli[b]=a;
}
void unioK(ll a, ll b){
a=rootK(a); b=rootK(b);
if (a>b) swap(a, b);
kajak[b]=a;
}
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
ll n, m, k; cin >> n >> m >> k;
bicikli.resize(n); kajak.resize(n);
for (ll i=0; i<n; i++){
bicikli[i]=i; kajak[i]=i;
}
for (ll i=0; i<m; i++){
ll a, b; cin >> a >> b; a--; b--;
unioB(a, b);
}
vector<ll> out(n, 0);
for (ll i=0; i<k; i++){
ll a, b; cin >> a >> b; a--; b--;
unioK(a, b);
}
for (ll i=0; i<n-1; i++){
for (ll j=i+1; j<n; j++){
if (rootB(i)==rootB(j) && rootK(i)==rootK(j)){
out[i]++; out[j]++;
}
}
}
for (auto& z:out) cout << z << ' ';
}
open /var/local/lib/isolate/428/box/main.exe: no such file or directory
main.cs(2,0): error CS1024: Wrong preprocessor directive
main.cs(2,6): error CS1525: Unexpected symbol `namespace', expecting `identifier' or `static'
main.cs(2,19): error CS1525: Unexpected symbol `;', expecting `identifier' or `static'
main.cs(9,4): error CS1525: Unexpected symbol `if', expecting `identifier' or `static'
main.cs(9,16): error CS1514: Unexpected symbol `[', expecting `.' or `{'
main.cs(9,18): error CS1525: Unexpected symbol `=='
Compilation failed: 6 error(s), 0 warnings