Cod sursa(job #3373126)

Utilizator CorvinJudge0Corvin Judge CorvinJudge0 Data 6 noiembrie 2026 09:19:11
Problema Arbore partial de cost minim Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.48 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("apm.in");
ofstream fout("apm.out");
int a[101][101],x,y,n,ok1,ok2,nv,i,j,b[101];
int main()
{
    fin >> n >> m;
     nv=n;
    for(i=1;i<=m;i++)
   {
       fin >> x >> y >> c;
        if(a[x][y]==0)
        {
            a[x][y]=a[y][x]=1;
            ok2++;
        }
    }

    while(nv>0)
    {
        if(a[nv][nv-1]==1 && a[nv-1][nv]==1) ok1=1;
        nv--;
    }

    if(ok1==1 && ok2==n-1);
    return 0;
}