Cod sursa(job #2815024)

Utilizator razviii237Uzum Razvan razviii237 Data 8 decembrie 2021 23:30:19
Problema A+B Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 1.01 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;

ifstream f("circulatie.in");
ofstream g("circulatie.out");

const int maxn = 1e5+5;

int n;
vector <int> v[maxn];
int a[maxn][4];
int u[maxn], l[maxn], r[maxn];
int viz[maxn];

bool check(int x) {
    if(viz[x] == 1)
        return false;
    viz[x] = 1;

    int i;
    i = 0;
    for(auto u : v[x]) {
        i ++;

    }

    i = 0;

    return false;
}

int main()
{
    int x, y, i;

    f >> n;
    for(i = 1; i <= 3 * n; i ++) {
        f >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }

    ok = true;
    while(ok == true) {
        ok = false;
        memset(viz, 0, sizeof(viz));
        for(i = 1; i <= n; i ++) {
            if(u[i] != 3 || l[i] != 0) {
                if(check(i) == true) {
                    ok = true;
                }
            }
        }
    }


    f.close(); g.close();
    return 0;
}