Submission #100791

# Submission time Handle Problem Language Result Execution time Memory
100791 2019-03-14T13:08:18 Z Liiiov_V Race (IOI11_race) C++17
Compilation error
0 ms 0 KB
#include <iostream>
//#include <fstream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <functional>
#include <cmath>
#include <map>
#include <cstdint>
#include <set>
#include <unordered_map>
using namespace std;
//ifstream fin("dq.in");
//ofstream fout("dq.out");

#define ll long long
#define ld long double
#define mp make_pair
#define pb push_back
#define fr(i, n) for(ll i=0;i<(ll)n;i++)
#define frx(i, x, n) for(ll i=(ll)x;i<(ll)n;i++)
#define frb(i, n) for(ll i=(ll)n-1;i>=0;i--)
#define frbx(i, x, n) for(ll i=(ll)n-1;i>=(ll)x;i--)
const int64_t mod = (ll)1e9 + 7;
const int64_t primm = 998244353;

ll n, k, h[1000005][2], l[1000005], ans=mod*mod, centr, order[1000005], ans[1000005];
vector<pair<ll, ll>> g[200005];
queue<ll> qu;
bool col[1000005];

void dfs(ll x, ll her)
{
	if(g[x].size()==1)
	{
		order[x]=1;
		return;
	}
	ll sum=1;
	fr(i, g[x].size())
	{
		if(g[x][i].first!=her && !col[g[x][i].first])
		{
			dfs(g[x][i].first, x);
			sum+=order[g[x][i].first];
		}
	}
	order[x]=sum;
	return;
}

void find(ll x)
{
	ll sum=1, mok=0;
	fr(i, g[x].size())
	{
		dfs(g[x][i].first, x);
		sum+=order[g[x][i].first];
	}
	centr=x;
	while(mok==0)
	{
		fr(i, g[centr].size())
		{
			if(order[g[centr][i].first]>=sum/2)
			{
				centr=g[centr][i].first;
				break;
			}
			if(i==g[centr].size()-1)
				mok++;
		}
	}
	solve();
	fr(i, g[centr].size())
	{
		if(!col[g[centr][i].first])
			qu.push(g[centr][i].first);
	}
	return;
}

ll get(ll x)
{
}

void solve()
{
	fr(i, g[centr].size())
	{

	}
}

int main()
{
	cin>>n>>k;
	fr(i, k)
		cin>>h[i][0]>>h[i][1];
	fr(i, k)
	{
		cin>>l[i];
		g[h[i][0]].push_back(mp(h[i][1], l[i]));
		g[h[i][1]].push_back(mp(h[i][0], l[i]));
	}
	qu.push(0);
	while(!qu.empty())
	{
		ll f=qu.front();
		col[f]=true;
		find(f);
	}
	return 0;
}

Compilation message

race.cpp:30:84: error: conflicting declaration 'long long int ans [1000005]'
 ll n, k, h[1000005][2], l[1000005], ans=mod*mod, centr, order[1000005], ans[1000005];
                                                                                    ^
race.cpp:30:37: note: previous declaration as 'long long int ans'
 ll n, k, h[1000005][2], l[1000005], ans=mod*mod, centr, order[1000005], ans[1000005];
                                     ^~~
race.cpp: In function 'void find(long long int)':
race.cpp:73:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if(i==g[centr].size()-1)
       ~^~~~~~~~~~~~~~~~~~~
race.cpp:77:2: error: 'solve' was not declared in this scope
  solve();
  ^~~~~
race.cpp: In function 'long long int get(long long int)':
race.cpp:88:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^