| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 48121 | Extazy | 캥거루 (CEOI16_kangaroo) | C++17 | 2 ms | 568 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N = 20;
int n,cs,cf,fact[N],a[N],ans;
bool check() {
for(int i=2;i<n;i++) {
if(!((a[i-1]<a[i] && a[i+1]<a[i]) || (a[i-1]>a[i] && a[i+1]>a[i]))) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int i,j;
scanf("%d %d %d", &n, &cs, &cf);
fact[0]=1;
for(i=1;i<=n-2;i++) {
fact[i]=fact[i-1]*i;
}
for(i=1;i<=n;i++) {
a[i]=i;
}
swap(a[1],a[cs]);
swap(a[n],a[cf]);
for(j=1;j<=fact[n-2];j++) {
next_permutation(a+2,a+n);
if(check()) ++ans;
}
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
