Submission #1005173

#TimeUsernameProblemLanguageResultExecution timeMemory
1005173RifalKangaroo (CEOI16_kangaroo)C++14
6 / 100
2086 ms348 KiB
#include <bits/stdc++.h> #include <fstream> #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #define endl '\n' #define mod 1000000007 #define INF 1000000000 #define INF2 2000000000 #define fi first #define se second using namespace std; double const EPS = 1e-14; const int P = 1007; typedef long long ll; using namespace __gnu_pbds; typedef long long ll; typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, cs, cf; cin >> n >> cs >> cf; vector<int> v(n); ll ans = 0; iota(v.begin(),v.end(),1); do { if(v[0] == cs && v[n-1] == cf) { bool check = true; for(int i = 2; i < n; i++) { if(v[i-2] < v[i-1] && v[i] > v[i-1]) check = false; if(v[i-2] > v[i-1] && v[i] < v[i-1]) check = false; } if(check) 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...