# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
52826 | 2018-06-27T03:46:31 Z | tataky(#1371) | 캥거루 (CEOI16_kangaroo) | C++11 | 2 ms | 496 KB |
#include <stdio.h> #include <algorithm> int a[8], n, b, e; using namespace std; bool ok() { if (a[0] != b || a[n - 1] != e) return false; if (n <= 2) return true; bool pre = (a[0] < a[1]); for (int i = 2; i < n; i++) { if (pre == (a[i - 1] < a[i])) return false; pre = !pre; } return true; } int main() { scanf("%d %d %d", &n, &b, &e); --b; --e; if (n > 8) return 0; for (int i = 0; i < n; i++) a[i] = i; int res = 0; do { if (ok()) res++; } while (next_permutation(a, a + 8)); printf("%d\n", res); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 496 KB | Output isn't correct |