# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
838954 | 2023-08-28T10:27:09 Z | rahidilbayramli | Kangaroo (CEOI16_kangaroo) | C++17 | 2000 ms | 300 KB |
#include<bits/stdc++.h> #define ll long long #define ld long double #define vi vector<int> #define vl vector<ll> #define all(v) v.begin(), v.end() #define pb push_back #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; int main() { ll n, cs, cf, i, j, ans = 0, k = 0; cin >> n >> cs >> cf; int v[n+1]; for(i = 1; i <= n; i++) v[i] = i; while(next_permutation(v+1, v+n+1)) { k = 0; if(v[1] == cs && v[n] == cf) { k = 2; for(i = 2; i <= n - 1; i++) { if((v[i] > v[i-1] && v[i] > v[i+1]) || (v[i] < v[i-1] && v[i] < v[i+1])) k++; } if(k == n) ans++; ans %= 1000000007; } } cout << ans << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
3 | Execution timed out | 2066 ms | 212 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
3 | Execution timed out | 2066 ms | 212 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 296 KB | Output is correct |
2 | Correct | 0 ms | 300 KB | Output is correct |
3 | Execution timed out | 2066 ms | 212 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |