답안 #114600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
114600 2019-06-02T04:03:44 Z faustaadp 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
0 / 100
7 ms 5112 KB
#include "garden.h"
#include "gardenlib.h"
#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;
int hz,b[10101],te,j;
vector<pair<int,int> > v[202020];
int cek(int aa,int bb)
{
	//cout<<j<<" "<<aa<<" "<<bb<<"\n";
	if(bb==0)
		return aa;
	ll ii;
	for(ii=0;ii<v[aa].size();ii++)
		if(b[v[aa][ii].fi]!=te)
		{
			b[v[aa][ii].fi]=te;
			return cek(v[aa][ii].se,bb-1);
		}
	for(ii=0;ii<v[aa].size();ii++)
			b[v[aa][ii].fi]=0;
	for(ii=0;ii<v[aa].size();ii++)
		if(b[v[aa][ii].fi]!=te)
		{
			b[v[aa][ii].fi]=te;
			return cek(v[aa][ii].se,bb-1);
		}
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
  int i;
  for(i=0;i<M;i++)
  {
  	v[R[i][0]].pb(mp(i,R[i][1]));
  	v[R[i][1]].pb(mp(i,R[i][0]));
  }
  for(i=0;i<N;i++)
  {
  	sort(v[i].begin(),v[i].end());
  	//reverse(v[i].begin(),v[i].end());
  }
  for(i=0; i<Q; i++)
  {
  	hz=0;
  	for(j=0;j<N;j++)
  	{
  		te++;
  		//cout<<j<<" "<<cek(j,G[i])<<"\n";
  		hz+=(cek(j,G[i])==P);
  	}
    answer(hz);
  }
}


Compilation message

garden.cpp: In function 'int cek(int, int)':
garden.cpp:18:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ii=0;ii<v[aa].size();ii++)
           ~~^~~~~~~~~~~~~
garden.cpp:24:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ii=0;ii<v[aa].size();ii++)
           ~~^~~~~~~~~~~~~
garden.cpp:26:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ii=0;ii<v[aa].size();ii++)
           ~~^~~~~~~~~~~~~
garden.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 5112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 5112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 5112 KB Output isn't correct
2 Halted 0 ms 0 KB -