141092025-01-09 19:38:08BencuElágazás nélküli úton levő települések (50 pont)cpp17Wrong answer 2/5035ms32000 KiB
#include <bits/stdc++.h>

using namespace std;
int n,m,a[10000][10000],b[10000],M[10000],s;
bool meg[10000];
/*struct telep {

}a[10000];*/
void be() {
    ifstream f("be.in");
    cin>>n>>m;
    for (int i=1; i<=m; i++) {
        int x,y;
        cin>>x>>y;
        a[x][y]=1;
        a[y][x]=1;
        b[x]++;
        b[y]++;
    }
}
void bejar(int x) {
    int i=1;
    while (a[i][x]!=1 || meg[i]==1) i++;
    if(meg[i]==0) {
        M[s]=i;
        s++;
        meg[i]=1;
        if (b[i]==2) bejar(i);
    }
}

int main()
{
    be();
    cout<<0;
    return 0;
    //for (int i=1; i<=n; i++) cout<<i<<"-"<<b[i]<<endl;
    for (int i=1; i<=n; i++) {
        if(b[i]==1) {
            meg[i]=1;
            bejar(i);
        }
    }
    if (s!=0) {
        cout<<s<<endl;
        for (int i=0; i<s; i++) cout<<M[i]<<" ";
    }
    else cout<<0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/50
1Wrong answer0/01ms316 KiB
2Runtime error0/032ms32000 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Accepted2/21ms500 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Wrong answer0/27ms6964 KiB
9Wrong answer0/217ms18688 KiB
10Runtime error0/235ms32000 KiB
11Runtime error0/228ms32000 KiB
12Runtime error0/227ms32000 KiB
13Wrong answer0/37ms6200 KiB
14Wrong answer0/317ms16428 KiB
15Wrong answer0/320ms25916 KiB
16Runtime error0/327ms32000 KiB
17Runtime error0/332ms32000 KiB
18Runtime error0/334ms32000 KiB
19Runtime error0/327ms32000 KiB
20Runtime error0/327ms32000 KiB
21Runtime error0/332ms32000 KiB
22Runtime error0/327ms32000 KiB