# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
893588 | 2023-12-27T07:16:05 Z | vjudge1 | Kangaroo (CEOI16_kangaroo) | C++17 | 2 ms | 348 KB |
#include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 2000 + 10; const ll mod = 1e9 + 7; ll um(ll a, ll b){ return ((1LL * a * b) % mod + mod) % mod; } ll subr(ll a, ll b){ return ((1LL * a - b) % mod + mod) % mod; } ll binpow(ll x, ll step){ ll res = 1LL; while(step){ if(step & 1) res = um(res, x); x = um(x, x); step /= 2; } return res; } bool was[N]; int cnt, n, ans, f; void calc(int index, int dir){ //cout << index << " "<< dir << endl; if(cnt == n){ if(index == f) ans++; return; } if(dir <= 0){ for(int i = index + 1; i <= n; i++){ if(was[i]) continue; was[i] = true; cnt++; calc(i, 1); cnt--; was[i] = false; } } if(dir >= 0){ for(int i = index - 1; i >= 1; i--){ if(was[i]) continue; was[i] = true; cnt++; calc(i, -1); cnt--; was[i] = false; } } } int main() { freopen("kangaroo.txt", "r", stdin); freopen("kangaroo.txt", "w", stdout); ios::sync_with_stdio(false); cin.tie(NULL); int s; cin >> n >> s >> f; was[s] = true; cnt = 1; calc(s, 0); cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |