답안 #1005173

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1005173 2024-06-22T08:24:56 Z Rifal 캥거루 (CEOI16_kangaroo) C++14
6 / 100
2000 ms 348 KB
#include <bits/stdc++.h>
#include <fstream>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define endl '\n'
#define mod 1000000007
#define INF 1000000000
#define INF2 2000000000
#define fi first
#define se second
using namespace std;
double const EPS = 1e-14;
const int P = 1007;
typedef long long ll;
using namespace __gnu_pbds;
typedef long long ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order, order_of_key

int main()
{
    ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    int n, cs, cf; cin >> n >> cs >> cf;
    vector<int> v(n);
    ll ans = 0;
    iota(v.begin(),v.end(),1);
    do {
        if(v[0] == cs && v[n-1] == cf) {
            bool check = true;
            for(int i = 2; i < n; i++) {
                if(v[i-2] < v[i-1] && v[i] > v[i-1]) check = false;
                if(v[i-2] > v[i-1] && v[i] < v[i-1]) check = false;
            }
            if(check) ans++;
        }
    } while(next_permutation(v.begin(),v.end()));
    cout << ans << endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2086 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2086 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Execution timed out 2086 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -