Submission #1294109

#TimeUsernameProblemLanguageResultExecution timeMemory
1294109zahra_Kangaroo (CEOI16_kangaroo)C++20
6 / 100
2095 ms572 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main(){ int n , cs , cf; cin >> n >> cs >> cf; int ans = 0 ; vector<int>v(n); for(int i = 0 ; i < n ; i++){ v[i] = i + 1; } do{ if(v[0] != cs || v[n - 1] != cf){ continue; } bool ok = true; for(int i = 1 ; i < n - 1 ; i++){ int last = v[i - 1]; int now = v[i]; int next = v[i + 1]; if(last < now && next >= now){ ok = false; break; } if(last > now && next <= now){ ok = false; break; } } if(ok){ ans++; } } while(next_permutation(v.begin() , v.end()));{ cout << ans << endl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...