#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);
}
return cek(v[aa][0].se,bb-1);
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
answer(2);
return ;
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++)
~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
5112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |