# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005044 | SulA | Kangaroo (CEOI16_kangaroo) | C++17 | 2065 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
int n,cs,cf; cin >> n >> cs >> cf;
vector<int> p;
for (int i = 1; i <= n; i++) {
p.push_back(i);
}
long long cnt = 0;
do {
bool isGood = p.front() == cs && p.back() == cf;
if (!isGood) continue;
for (int i = 1; i < n-1; i++) {
isGood &= p[i+1] > p[i] != p[i] > p[i-1];
}
cnt += isGood;
} while (next_permutation(p.begin(), p.end()));
cout << cnt;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |