| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1288018 | SmuggingSpun | 캥거루 (CEOI16_kangaroo) | C++20 | 1 ms | 572 KiB |
#include<bits/stdc++.h>
#define taskname "B"
using namespace std;
int n, cs, cf;
namespace sub1{
void solve(){
int ans = 0;
vector<int>p(n);
iota(p.begin(), p.end(), 1);
do{
if(cs == p[0] && cf == p[n - 1]){
bool f1 = true, f2 = true;
for(int i = 1; i < n; i++){
if(((i & 1) && p[i] > p[i - 1]) || ((~i & 1) && p[i] < p[i - 1])){
f1 = false;
}
if(((i & 1) && p[i] < p[i - 1]) || ((~i & 1) && p[i] > p[i - 1])){
f2 = false;
}
}
if(f1 || f2){
ans++;
}
}
} while(next_permutation(p.begin(), p.end()));
cout << ans;
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
cin >> n >> cs >> cf;
if(n <= 8){
sub1::solve();
}
}
컴파일 시 표준 에러 (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... | ||||
