제출 #1117754

#제출 시각아이디문제언어결과실행 시간메모리
1117754vjudge1캥거루 (CEOI16_kangaroo)C++17
6 / 100
2066 ms336 KiB
#include <bits/stdc++.h> using namespace std; int main() { #ifdef ONLINE_JUDGE ifstream fin("kangaroo.in"); ofstream fout("kangaroo.out"); if (!fin or !fout) { return 1; } #else istream &fin = cin; ostream &fout = cout; #endif int n, cs, cf, ans = 0; fin >> n >> cs >> cf; vector<int> route; for (int i = 1; i <= n; i++) { route.push_back(i); } do { if (route.front() != cs or route.back() != cf) { goto next; } for (int i = 1; i < n - 1; i++) { int prev = route[i - 1], current = route[i], next = route[i + 1]; if ((prev < current and next >= current) or (current < prev and current >= next)) { goto next; } } ans++; next: continue; } while (next_permutation(route.begin(), route.end())); fout << ans << '\n'; #ifdef ONLINE_JUDGE fout.close(); #endif }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...