Cod sursa(job #2553055)

Utilizator Idk.Voicu Stefan Idk. Data 21 februarie 2020 15:56:32
Problema Ciclu Eulerian Scor 0
Compilator c-64 Status done
Runda Arhiva educationala Marime 1.12 kb
#include <stdio.h>
#include <stdlib.h>
typedef struct muchie{
    int x, y;
}muchie;
muchie f[500000];
typedef struct nod{
    int mc;
    struct nod*urm;
}nod;
nod* v[100000];
void add(int n, int m) {
    if (v[n] == NULL) {
        v[n]->mc = m;
    } else {
        nod*p = malloc(sizeof(nod));
        while (p->urm != NULL) {
            p = p->urm;
        }
        p->urm->mc = m;
    }
}
int st[500000];
int main()
{
    FILE*in = fopen("ciclueuler.in", "r");
    FILE*out = fopen("ciclueuler.out", "w");
    int n, m, i, a, b;
    fscanf(in, "%d%d", &n, &m);
    for (i = 0; i < m; i++) {
        fscanf(in, "%d%d", &a, &b);
        f[i].x = a;
        f[i].y = b;
        add(a, i);
        add(b, i);
    }
    int s = 1;
    for (i = 0; i <= n; i++) {
        if (st[i] % 2 == 1) {
            fprintf(out, "-1");
            return 0;
        }
        st[i] = 0;
    }
    st[0] = 1;
    nod*p = malloc(sizeof(nod));
    while (st > 0) {
        p = v[st[s-1]];
        while (p->urm != NULL) {
            if (f[p->mc] == 0) {

            }
        }
    }

    return 0;
}