제출 #1294040

#제출 시각아이디문제언어결과실행 시간메모리
1294040cavid_07캥거루 (CEOI16_kangaroo)C++20
0 / 100
1 ms572 KiB
#include <bits/stdc++.h> using namespace std; #define F first #define S second #define pb push_back #define int long long #define no cout << "No" << '\n' #define yes cout << "Yes" << '\n' #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define inp(v) for (auto &a : v) cin >> a; #define out(v) for (auto &a : v) cout << a << ' '; void solve() { int n, a, b; cin >> n >> a >> b; vector<int> vt(n); for(int i = 1; i <= n; i++){ vt[i - 1] = i; } int mod = 1e9 + 7; int ans = 0; do { bool ok = true; for (int i = 1; i < n - 1; i++) { if (!(vt[i] > vt[i - 1] and vt[i] < vt[i + 1] or vt[i] < vt[i - 1] and vt[i] > vt[i + 1])){ ok = false; } } if (ok) ans++; }while(next_permutation(all(vt))); cout << ans << '\n'; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; //cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...