답안 #257373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
257373 2020-08-04T07:29:38 Z 최은수(#5045) Worst Reporter 2 (JOI16_worst_reporter2) C++17
15 / 100
112 ms 412 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[v[k++]])
                    fl=0;
        if(fl)
            ans=min(ans,__builtin_popcount(i));
    }
    cout<<ans<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
8 Correct 13 ms 412 KB Output is correct
9 Correct 34 ms 384 KB Output is correct
10 Correct 30 ms 384 KB Output is correct
11 Correct 28 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
8 Correct 13 ms 412 KB Output is correct
9 Correct 34 ms 384 KB Output is correct
10 Correct 30 ms 384 KB Output is correct
11 Correct 28 ms 384 KB Output is correct
12 Incorrect 112 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
8 Correct 13 ms 412 KB Output is correct
9 Correct 34 ms 384 KB Output is correct
10 Correct 30 ms 384 KB Output is correct
11 Correct 28 ms 384 KB Output is correct
12 Incorrect 112 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 8 ms 384 KB Output is correct
4 Correct 7 ms 384 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 12 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
8 Correct 13 ms 412 KB Output is correct
9 Correct 34 ms 384 KB Output is correct
10 Correct 30 ms 384 KB Output is correct
11 Correct 28 ms 384 KB Output is correct
12 Incorrect 112 ms 384 KB Output isn't correct
13 Halted 0 ms 0 KB -