Submission #257372

# Submission time Handle Problem Language Result Execution time Memory
257372 2020-08-04T07:28:28 Z 최은수(#5045) None (JOI16_worst_reporter2) C++17
0 / 100
0 ms 384 KB
#include<iostream>
#include<vector>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18+7;
int a[200010],b[200010];
int c[200010],d[200010];
bool del[200010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>a[i]>>b[i];
    for(int i=0;i<n;i++)
        cin>>c[i]>>d[i];
    int ans=n;
    for(int i=0;i<1<<n;i++)
    {
        for(int j=0;j<n;j++)
            del[j]=0;
        bool fl=1;
        vector<int>v;
        for(int j=0;j<n&&fl;j++)
        {
            if(i>>j&1)
            {
                v.eb(j);
                continue;
            }
            bool ok=0;
            for(int k=0;k<n&&!ok;k++)
                if(!del[k]&&b[k]<=d[j]&&a[k]==c[j])
                    del[k]=1,ok=1;
            if(!ok)
                fl=0;
        }
        if(!fl)
            continue;
        for(int j=0,k=0;j<n;j++)
            if(!del[j])
                if(b[j]>d[k++])
                    fl=0;
        if(fl)
            ans=min(ans,__builtin_popcount(i));
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -