Submission #125670

# Submission time Handle Problem Language Result Execution time Memory
125670 2019-07-06T07:52:48 Z faustaadp timeismoney (balkan11_timeismoney) C++17
10 / 100
7 ms 800 KB
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,m,i,p[220],ta,tb,tc,td,h1,h2;
pair<pair<ll,ll>,pair<ll,ll> > E[10101];
vector<pair<ll,ll> > isi;
ll car(ll aa)
{
	if(p[aa]==aa)return aa;
	else return p[aa]=car(p[aa]);
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(i=0;i<n;i++)p[i]=i;
	for(i=1;i<=m;i++)
	{
		cin>>ta>>tb>>tc>>td;
		E[i]=mp(mp(tc,td),mp(ta,tb));
	}
	sort(E+1,E+1+m);
	for(i=1;i<=n;i++)
	{
		if(car(E[i].se.fi)!=car(E[i].se.se))
		{
			h1+=E[i].fi.fi;
			p[car(E[i].se.fi)]=car(E[i].se.se);
			isi.pb(E[i].se);
		}
	}
	h2=h1;
	cout<<h1<<" "<<h2<<"\n";
	for(i=0;i<(n-1);i++)
		cout<<isi[i].fi<<" "<<isi[i].se<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Incorrect 2 ms 372 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 3 ms 376 KB Output isn't correct
8 Incorrect 7 ms 800 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Incorrect 2 ms 376 KB Output isn't correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 3 ms 504 KB Output isn't correct
17 Incorrect 3 ms 504 KB Output isn't correct
18 Incorrect 3 ms 376 KB Output isn't correct
19 Incorrect 7 ms 760 KB Output isn't correct
20 Incorrect 7 ms 760 KB Output isn't correct