제출 #1358569

#제출 시각아이디문제언어결과실행 시간메모리
1358569po_rag526Matryoshka (JOI16_matryoshka)C++20
11 / 100
2096 ms344 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, q;
    cin >> n >>q;
    vector<pair<int,int>>qer(n + 1);
    vector<pair<int,int>>vt(1);
    for(int i = 1;i <= n; i++){
        cin >> qer[i].f >> qer[i].s;
    }
    //while(q--){
        int a, b;
        cin >> a >> b;
        cout << endl << endl;
        for(int i = 1; i <= n; i++){
            if(qer[i].f >= a && qer[i].s <= b){
                vt.pb(qer[i]);
            }
        }
        n = vt.size() - 1;
        vector<int>v;
        for(int i = 1;i <= n; i++){
            v.pb(i);
        }
        /*for(int i = 1;i <= n; i++){
            cout << vt[i].f << " " << vt[i].s << endl;
        }*/
        int cvb = LLONG_MAX;
        /*for(auto i : v){
            cout << i << " ";
        }cout<<endl;*/
        do{
            vector<pair<int,int>>arr(1);
            for(auto i : v){
                arr.pb(vt[i]);
            }
            int ans = 0;
            int say = 0;
            arr.pb({LLONG_MAX, LLONG_MAX});
            for(int i = 1;i <= n; i++){
                if(arr[i].f > arr[i + 1].f && arr[i].s > arr[i + 1].s){
                    
                }
                else{
                    ans++;
                }
            }
            cvb = min(cvb, ans);
            
        }while(next_permutation(v.begin(), v.end()));
        cout << cvb << endl;
    //}
}
void You_can_do_it() {
    cout << 2 * 3 * 4 * 5 * 6 * 7 * 8 * 9 * 10 * 10;
}
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();
    }
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…