Submission #960028

# Submission time Handle Problem Language Result Execution time Memory
960028 2024-04-09T14:12:06 Z ramalzaher Kangaroo (CEOI16_kangaroo) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set ;
#define int long long
#define F first
#define S second
#define rep(i , j , n ) for(int i = j ;i < n; i++ )
#define FOR(i , n ) rep(i ,0 , n )
#define sz size()
#define pb push_back
#define all(x) x.begin() , x.end()
#define vi vector<int>
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
#define cans cout<<ans<<endl;
#define forx(i, x) for(auto &i : x)
#define fast
#define pii pair<int ,int >
#define endl "\n"
#define sp ' '
#define test int t ; cin >> t ; while(t--)
const int N = 300 ;
const int inf = 1e15 ;
    int n , s ,e;
    int rec(int i , bool prev , int jumps ) {
    if(jumps==n-1)if(i==e)return 1 ;else return 0 ;
    if(i==0)return 0 ;
    int ans = 0 ;
    if(prev == 0 ){
        rep(j , i+1 , n+1 ){
        ans += rec(j, prev^1, jumps+1);
        }
    }else {
    rep(j , 0 , i ) {ans += rec(j , prev^1 , jumps+1 ) ;  }

    }
    return ans ;
    }

main()
{
    cin >> n >> s >> e ;
    cout<<rec(s , 0 , 0 )/2;



}

Compilation message

kangaroo.cpp: In function 'long long int rec(long long int, bool, long long int)':
kangaroo.cpp:27:7: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   27 |     if(jumps==n-1)if(i==e)return 1 ;else return 0 ;
      |       ^
kangaroo.cpp: At global scope:
kangaroo.cpp:41:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   41 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -