답안 #114603

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
114603 2019-06-02T04:11:23 Z faustaadp 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
49 / 100
5000 ms 6008 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,int cc)
{
	//cout<<j<<" "<<aa<<" "<<bb<<"\n";
	if(bb==0)
		return aa;
	ll ii;
	for(ii=0;ii<v[aa].size();ii++)
	{
		if(v[aa][ii].se!=cc)
			return cek(v[aa][ii].se,bb-1,aa);
	}
	return cek(v[aa][0].se,bb-1,aa); 
}
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++)
  	{
  		//cout<<j<<" "<<cek(j,G[i])<<"\n";
  		hz+=(cek(j,G[i],-1)==P);
  	}
    answer(hz);
  }
}


Compilation message

garden.cpp: In function 'int cek(int, int, int)':
garden.cpp:18:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ii=0;ii<v[aa].size();ii++)
           ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 5112 KB Output is correct
2 Correct 5 ms 5112 KB Output is correct
3 Correct 10 ms 5116 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 8 ms 5112 KB Output is correct
7 Correct 7 ms 5112 KB Output is correct
8 Correct 7 ms 5112 KB Output is correct
9 Correct 10 ms 5368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 5112 KB Output is correct
2 Correct 5 ms 5112 KB Output is correct
3 Correct 10 ms 5116 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 8 ms 5112 KB Output is correct
7 Correct 7 ms 5112 KB Output is correct
8 Correct 7 ms 5112 KB Output is correct
9 Correct 10 ms 5368 KB Output is correct
10 Correct 11 ms 5112 KB Output is correct
11 Execution timed out 5021 ms 6008 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 5112 KB Output is correct
2 Correct 5 ms 5112 KB Output is correct
3 Correct 10 ms 5116 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 8 ms 5112 KB Output is correct
7 Correct 7 ms 5112 KB Output is correct
8 Correct 7 ms 5112 KB Output is correct
9 Correct 10 ms 5368 KB Output is correct
10 Correct 11 ms 5112 KB Output is correct
11 Execution timed out 5021 ms 6008 KB Time limit exceeded
12 Halted 0 ms 0 KB -