Submission #1117750

#TimeUsernameProblemLanguageResultExecution timeMemory
1117750vjudge1캥거루 (CEOI16_kangaroo)C++17
Compilation error
0 ms0 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 (ranges::next_permutation(route).found);

  fout << ans << '\n';

#ifdef ONLINE_JUDGE
  fout.close();
#endif
}

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:39:12: error: 'ranges' has not been declared
   39 |   } while (ranges::next_permutation(route).found);
      |            ^~~~~~