답안 #592662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592662 2022-07-09T12:21:49 Z Khizri 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
0 / 100
9 ms 5076 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0)
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
const int mxn=2e5+5;
int n,m,k,x,ans,cnt;
vector<int>vt[mxn];
void dfs(int u,vector<int>&v){
    if(cnt==k&&u==x){
        ans++;
        return;
    }
    else if(cnt==k){
        return;
    }
    if(v[u]+1>vt[u].size()){
        return;
    }
    while(v[u]+1<=vt[u].size()){
        v[u]++;
        cnt++;
        dfs(vt[u][v[u]-1],v);
        cnt++;
        if(cnt==k){
            if(u==x){
                ans++;
            }
            return;
        }
    }
    return;
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
    n=N,m=M,k=G[0],x=P;
    for(int i=0;i<m;i++){
        vt[R[i][0]].pb(R[i][1]);
        vt[R[i][1]].pb(R[i][0]);
    }
    for(int i=1;i<=n;i++){
        cnt=0;
        vector<int>v(n+5);
        dfs(i-1,v);
    }
    answer(ans);
}

Compilation message

garden.cpp: In function 'void dfs(int, std::vector<int>&)':
garden.cpp:29:14: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     if(v[u]+1>vt[u].size()){
garden.cpp:32:17: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     while(v[u]+1<=vt[u].size()){
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 5076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 5076 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 5076 KB Output isn't correct
2 Halted 0 ms 0 KB -