답안 #269321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
269321 2020-08-17T06:29:01 Z PKhing 최후의 만찬 (IOI12_supper) C++14
0 / 100
175 ms 150768 KB
#include "advisor.h"
#include<bits/stdc++.h>
#define FOR(i,a) for(int i=0;i<a;i++)
#define FOR1(i,a) for(int i=1;i<=a;i++)
#define db(a) printf("<%d> ",a)
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb emplace_back
#define p emplace
#define ii pair<int,int>
#define ll long long
#define rf() freopen("_working/input.in","r",stdin)
#define pf() freopen("_working/output.out","w+",stdout)
using namespace std;
const int INF=1e9;

void ComputeAdvice(int *C, int N, int K, int M){
    queue<int> nxt[N];
    int t[N+K];
    int now[N];
    FOR(i,N){
        nxt[C[i]].p(i);
        now[i]=-1;
    }
    set<ii> s;
    FOR(i,N){
        if(i<K){
        now[i]=i;
        s.p(nxt[i].empty()?INF:nxt[i].front(),i);}
        if(!nxt[i].empty())nxt[i].pop();

    }
    FOR(i,N+K)t[i]=0;
    FOR(i,N){
        if(now[C[i]]!=-1){
            t[now[C[i]]]=1;
            now[C[i]]=i+K;
            s.erase(mp(i,C[i]));
            s.p(nxt[C[i]].empty()?INF:nxt[C[i]].front(),C[i]);
            if(!nxt[C[i]].empty())nxt[C[i]].pop();
            continue;
        }
        else{
            printf("<%d>\n",i);
            printf("erase %d nxt : %d\n",s.rbegin()->s,s.rbegin()->f);
            now[s.rbegin()->s]=-1;
            s.erase(*s.rbegin());
            now[C[i]]=i+K;
            s.p(nxt[C[i]].empty()?INF:nxt[C[i]].front(),C[i]);
            printf("insert %d at %d\n",C[i],nxt[C[i]].empty()?INF:nxt[C[i]].front());
            if(!nxt[C[i]].empty())nxt[C[i]].pop();
            continue;
        }
    }
    FOR(i,N+K){
        printf("%d ",t[i]);
        WriteAdvice(t[i]?'1':'0');
    }
}
#include "assistant.h"
#include<bits/stdc++.h>
#define FOR(i,a) for(int i=0;i<a;i++)
#define FOR1(i,a) for(int i=1;i<=a;i++)
#define db(a) printf("<%d> ",a)
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb emplace_back
#define p emplace
#define ii pair<int,int>
#define ll long long
#define rf() freopen("_working/input.in","r",stdin)
#define pf() freopen("_working/output.out","w+",stdout)
using namespace std;
const int INF=1e9;

void Assist(unsigned char *A, int N, int K, int R){
    queue<int> erase;
    set<int> sca;
    FOR(i,K){
        if(A[i]=='0'){
            erase.p(i);
        }
        sca.insert(i);
    }
    FOR(i,N){
        int a = GetRequest();
        if(sca.find(a)==sca.end()){
            sca.erase(erase.front());
            PutBack(erase.front());
            erase.pop();
        }
        if(A[i+K]=='0')erase.push(a);
        sca.insert(a);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 904 KB Error - Invalid Access
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 15360 KB Error - Invalid Access
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 132 ms 118392 KB Error - Invalid Access
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 6400 KB Error - Invalid Access
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 175 ms 147440 KB Error - Invalid Access
2 Incorrect 165 ms 147184 KB Error - Invalid Access
3 Incorrect 167 ms 147160 KB Error - Invalid Access
4 Incorrect 156 ms 147192 KB Error - Invalid Access
5 Incorrect 152 ms 147184 KB Error - Invalid Access
6 Incorrect 162 ms 147184 KB Error - Invalid Access
7 Incorrect 158 ms 147184 KB Error - Invalid Access
8 Incorrect 157 ms 147184 KB Error - Invalid Access
9 Incorrect 164 ms 147216 KB Error - Invalid Access
10 Incorrect 157 ms 150768 KB Error - Invalid Access