Submission #1294061

#TimeUsernameProblemLanguageResultExecution timeMemory
1294061ako_aqsinKangaroo (CEOI16_kangaroo)C++20
6 / 100
2095 ms572 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define f first
#define s second
#define pb push_back
#define yes cout << "yes" << endl;
#define YES cout << "YES" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
void never_give_up() {
    int n, s, f;
    cin >> n >> s >> f;
    if(n == 2){
        cout << 1 << endl;
        return;
    }
    //cout << s << " " << f << endl;
    set<vector<int>>sst;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            for(int k = 1; k <= n; k++){
                for(int g = 1; g <= n; g++){
                    for(int l = 1; l <= n; l++){
                        for(int r = 1; r <= n; r++){
                            for(int h = 1; h <= n; h++){
                                for(int b = 1; b <= n; b++){
                                    vector<int>st;
                                    map<int, int>mp;
                                    if(mp[i] == 0){
                                        st.pb(i);
                                        mp[i]++;
                                    }
                                    if(mp[j] == 0){
                                        st.pb(j);
                                        mp[j]++;
                                    }
                                    if(mp[k] == 0){ 
                                        st.pb(k);
                                        mp[k]++;
                                    }
                                    if(mp[g] == 0){ 
                                        st.pb(g);
                                        mp[g]++;
                                    }
                                    if(mp[l] == 0){
                                        st.pb(l);
                                        mp[l]++;
                                    }
                                    if(mp[r] == 0){ 
                                        st.pb(r);
                                        mp[r]++;
                                    }
                                    if(mp[h] == 0){
                                        st.pb(h);
                                        mp[h]++;
                                    }
                                    if(mp[b] == 0){
                                        st.pb(b);
                                        mp[b]++;
                                    }
                                //int mini = min({i, j, k, g, l, r, h, b});
                                //int maxa = min({i, j, k, g, l, r, h, b});
                                    int mini = st[0];
                                    int maxa = st[st.size() - 1];
                                    if(mini==s&&maxa==f&&st.size()==n){
                                        //for(auto w : st) cout << w << " ";
                                        //cout << endl;
                                        sst.insert(st);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    //cout << sst.size();
    int sum = 0;
    for(auto vt : sst){
        int h = 0;
        int sa = 0;
        bool ok = true;
        for(int i = 1; i < vt.size() - 1; i++){
            if(vt[i] > vt[i - 1]){
                if(vt[i + 1] > vt[i]){
                    ok = false;
                }
            }
            else if(vt[i] < vt[i - 1]){
                if(vt[i + 1] < vt[i]){
                    ok = false;
                }
            }
        }
        if(ok) sum++;
    }
    cout << sum << endl;
}
void You_can_do_it() {
    
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int THE_wasd = 1;               
    //cin >> THE_wasd;
    while(THE_wasd--){
        never_give_up();
        //You_can_do_it();
    }
}

















#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...