답안 #1060868

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1060868 2024-08-16T03:44:09 Z vjudge1 Job Scheduling (IOI19_job) C++17
컴파일 오류
0 ms 0 KB
#include "cards.h"
#include<bits/stdc++.h>
using namespace std;
int midpt,K,N;
map<tuple<int,int,int>,int> mp1;
map<pair<int,int>,int>mp2;
int fac(int n){
    if(!n)return 1;
    return n*fac(n-1);
}
int getbak(vector<int>ord){
    vector<int>huhhh;
    int n=ord.size();
    for(int i=0;i<n;i++)
        huhhh.push_back(find(ord.begin(),ord.end(),i)-ord.begin()),
        ord.erase(find(ord.begin(),ord.end(),i));
    int ans=0;
    for(int i=n;i--;){
        ans+=huhhh[n-i-1]*fac(i);
    }
    return ans;
}
vector<int>reorder(int val,vector<int>things){
    val--;
    int n=things.size();
    vector<int> huhhh;
    for(int i=n;i--;) {
        huhhh.push_back(val/fac(i));
        val%=fac(i);
    }
    vector<int>doodee;
    for(int i=n;i--;)
        doodee.insert(doodee.begin()+huhhh[i],things[i]);
    return doodee;
}
void init_magician(int N_, int K_) {
    mp1[{1,2,3}]=2;
    mp2[{1,3}]=2;
    mp1[{1,2,4}]=4;
    mp2[{1,2}]=4;
    mp1[{1,2,5}]=1;
    mp2[{2,5}]=1;
    mp1[{1,3,4}]=1;
    mp2[{3,4}]=1;
    mp1[{1,3,5}]=3;
    mp2[{1,5}]=3;
    mp1[{1,4,5}]=5;
    mp2[{1,4}]=5;
    mp1[{2,3,4}]=3;
    mp2[{2,4}]=3;
    mp1[{2,3,5}]=5;
    mp2[{2,3}]=5;
    mp1[{2,4,5}]=2;
    mp2[{4,5}]=2;
    mp1[{3,4,5}]=4;
    mp2[{3,5}]=4;
    midpt=N+1>>1,K=K_;
    N=N_;
}
 
void init_assistant(int N_, int K_) {
    mp1[{1,2,3}]=2;
    mp2[{1,3}]=2;
    mp1[{1,2,4}]=4;
    mp2[{1,2}]=4;
    mp1[{1,2,5}]=1;
    mp2[{2,5}]=1;
    mp1[{1,3,4}]=1;
    mp2[{3,4}]=1;
    mp1[{1,3,5}]=3;
    mp2[{1,5}]=3;
    mp1[{1,4,5}]=5;
    mp2[{1,4}]=5;
    mp1[{2,3,4}]=3;
    mp2[{2,4}]=3;
    mp1[{2,3,5}]=5;
    mp2[{2,3}]=5;
    mp1[{2,4,5}]=2;
    mp2[{4,5}]=2;
    mp1[{3,4,5}]=4;
    mp2[{3,5}]=4;
    midpt=N+1>>1,K=K_;
    N=N_;
}

std::vector<int> choose_cards(std::vector<int> cards) {
    sort(cards.begin(),cards.end());
    if(cards.size()==2)
        return vector<int>(1,cards[0]==1&&cards[1]==3?1:cards[1]);
    if(cards.size()==3){
        cards.erase(find(cards.begin(),cards.end(),mp1[{cards[0],cards[1],cards[2]}]));
        return cards;
    }
    int K=cards[0];
    cards.erase(cards.begin());
    return reorder(K,cards);
}

int find_discarded_card(std::vector<int> cards) {
    if(cards.size()==1)
        return cards[0]%3+1;
    if(cards.size()==2){
        return mp2[{cards[0],cards[1]}];
    }
    vector<int> act=cards;
    sort(act.begin(),act.end());
    for(auto&i:cards)
        i=lower_bound(act.begin(),act.end(),i)-act.begin();
    return 1+getbak(cards);
}

Compilation message

job.cpp:1:10: fatal error: cards.h: No such file or directory
    1 | #include "cards.h"
      |          ^~~~~~~~~
compilation terminated.