Submission #1117789

#TimeUsernameProblemLanguageResultExecution timeMemory
1117789vjudge1Kangaroo (CEOI16_kangaroo)C++17
6 / 100
2045 ms336 KiB
#include "bits/stdc++.h" using namespace std; int main() { int N, cs, cf; cin >> N >> cs >> cf; vector<int> a(N); iota(begin(a),end(a),1); int ans = 0; do { if (a[0] == cs && a[N - 1] == cf) { int f = a[1] > a[0]; int r = 1; for (int i = 2; i < N; i ++) { int d = a[i] > a[i - 1]; if (f == d) { r = 0; } f = d; } if (r) { ans ++; } } } while (next_permutation(begin(a),end(a))); cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...