Submission #1298225

#TimeUsernameProblemLanguageResultExecution timeMemory
1298225Cebrayil09Kangaroo (CEOI16_kangaroo)C++20
6 / 100
2094 ms572 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(0); cout.tie(0); int n, cs, cf; cin >> n >> cs >> cf; vector<int> v; for(int i = 1;i <= n;i++) { if(i != cs && i != cf) v.push_back(i); } int cnt = 0; do{ vector<int> path; path.push_back(cs); for(auto &i : v) path.push_back(i); path.push_back(cf); bool pre = (path[1] > path[0]), is = 1; for(int i = 2;i < path.size();i++) { bool now = (path[i] > path[i-1]); if(pre == now) { is = 0; break; } pre = now; } cnt += is; }while(next_permutation(v.begin(), v.end())); cout << cnt << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...