답안 #133010

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133010 2019-07-20T04:31:13 Z tinjyu 열대 식물원 (Tropical Garden) (IOI11_garden) C++14
49 / 100
105 ms 32288 KB
#include "garden.h"
#include "gardenlib.h"
#include <iostream>
using namespace std;
long long int pre,ans,n,m,p,map[1005][1005],tag[10005],ta;
int find(int x,int pe)
{
	//cout<<x<<" "<<pe<<endl;
	if(pe==ta)
	{
		if(x==p)ans++;
		return 0;
	}
	int tmp=0,now=-1,h=0;
	for(int i=0;i<n;i++)
	{
		if(map[x][i]!=-1)
		{
			if(now==-1)
			{
				if(map[x][i]==pre)h=1;
				tmp=map[x][i];
				now=i;
			}
			else
			{
				if(h==1)
				{
					if(map[x][i]!=pre)
					{
						h=0;
						tmp=map[x][i];
						now=i;
					}
					else if(map[x][i]<tmp)
					{
						tmp=map[x][i];
						now=i;
					}
				}
				else if(map[x][i]!=pre && map[x][i]<tmp)
				{
					tmp=map[x][i];
					now=i;
				}
			}
			//cout<<h<<" "<<tmp<<" "<<now<<" "<<i<<" "<<map[x][i]<<endl;
		}
	}
	tag[tmp]=1;
	pre=tmp;
	find(now,pe+1);
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
	n=N,m=M,p=P,ta=G[0];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)map[i][j]=-1;
	}
	for(int i=0;i<m;i++)
	{
		map[R[i][0]][R[i][1]]=i;
		map[R[i][1]][R[i][0]]=i;
	}
	for(int i=0;i<n;i++)
	{
		pre=-1;
		for(int j=0;j<m;j++)tag[j]=0;
		//cout<<i<<endl;
		find(i,0);
	}
    answer(ans);
}

Compilation message

garden.cpp: In function 'int find(int, int)':
garden.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6492 KB Output is correct
2 Correct 57 ms 7872 KB Output is correct
3 Correct 59 ms 8260 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 72 ms 8276 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 67 ms 8384 KB Output is correct
9 Correct 105 ms 8380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6492 KB Output is correct
2 Correct 57 ms 7872 KB Output is correct
3 Correct 59 ms 8260 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 72 ms 8276 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 67 ms 8384 KB Output is correct
9 Correct 105 ms 8380 KB Output is correct
10 Correct 100 ms 876 KB Output is correct
11 Runtime error 63 ms 32288 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 6492 KB Output is correct
2 Correct 57 ms 7872 KB Output is correct
3 Correct 59 ms 8260 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 72 ms 8276 KB Output is correct
7 Correct 3 ms 632 KB Output is correct
8 Correct 67 ms 8384 KB Output is correct
9 Correct 105 ms 8380 KB Output is correct
10 Correct 100 ms 876 KB Output is correct
11 Runtime error 63 ms 32288 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -