Submission #592822

# Submission time Handle Problem Language Result Execution time Memory
592822 2022-07-09T16:20:19 Z Khizri Tropical Garden (IOI11_garden) C++17
49 / 100
5000 ms 6876 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;
vector<int>vt[mxn];
void dfs(int u,int p,int cnt){
    if(cnt==k){
        if(x==u){
            ans++;
        }
        return;
    }
    if(vt[u][0]==p){
        if(vt[u].size()>1){
            dfs(vt[u][1],u,cnt+1);
        }
        else{
            dfs(vt[u][0],u,cnt+1);
        }
    }
    else{
        dfs(vt[u][0],u,cnt+1);
    }
}
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++){
        vector<int>v(n+5);
        vector<int>p(n+5,-1);
        dfs(i-1,i-1,0);
    }
    answer(ans);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 4 ms 5016 KB Output is correct
3 Correct 3 ms 5012 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5076 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 4 ms 5008 KB Output is correct
9 Correct 5 ms 5204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 4 ms 5016 KB Output is correct
3 Correct 3 ms 5012 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5076 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 4 ms 5008 KB Output is correct
9 Correct 5 ms 5204 KB Output is correct
10 Correct 7 ms 4948 KB Output is correct
11 Execution timed out 5065 ms 6876 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 4 ms 5016 KB Output is correct
3 Correct 3 ms 5012 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 3 ms 4948 KB Output is correct
6 Correct 4 ms 5076 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 4 ms 5008 KB Output is correct
9 Correct 5 ms 5204 KB Output is correct
10 Correct 7 ms 4948 KB Output is correct
11 Execution timed out 5065 ms 6876 KB Time limit exceeded
12 Halted 0 ms 0 KB -