답안 #170066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
170066 2019-12-24T00:49:25 Z tri 최후의 만찬 (IOI12_supper) C++14
0 / 100
214 ms 141552 KB
#include <bits/stdc++.h>
#include "advisor.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;

#define pb push_back
#define f first
#define s second

const int MAXN = 1e5;

queue<int> nUse[MAXN];

void ComputeAdvice(int *C, int N, int K, int M) {
    vi used(2 * N, 0);
    vi tInsert(N, 0);
    vi contain(N, 0);

    int nTInsert = K;

    for (int i = 0; i < N; i++) {
        nUse[C[i]].push(i);
    }

    for (int cC = 0; cC < N; cC++) {
        nUse[cC].push(N);
    }

    priority_queue<pi> allNext;

    for (int cC = 0; cC < K; cC++) {
        allNext.push({nUse[cC].front(), cC});
        contain[cC] = true;
        tInsert[cC] = cC;
    }

    for (int i = 0; i < N; i++) {
        int cC = C[i];
        nUse[cC].pop();
        if (contain[cC]) {
            used[tInsert[cC]] = true;
        } else {
            pi furtUse = allNext.top();
            allNext.pop();
            contain[furtUse.s] = false;

            allNext.push({nUse[cC].front(), cC});
            contain[cC] = true;
            tInsert[cC] = nTInsert++;
        }
    }

    for (int i = 0; i < 2 * N; i++) {
        WriteAdvice(used[i]);
    }
}
#include <bits/stdc++.h>
#include "assistant.h"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;

#define pb push_back
#define f first
#define s second

const int MAXN = 1e5;

void Assist(unsigned char *data, int N, int K, int R) {

    queue<int> unused;
    vi contain(N, 0);

    for (int i = 0; i < K; i++) {
        if (!data[i]) {
            unused.push(i);
        }
        contain[i] = true;
    }

    for (int i = 0; i < N; i++) {
        int cC = GetRequest();
        if (contain[cC]) {
            // do nothing
        } else {
            assert(unused.size() > 0);

            int remC = unused.front();
            unused.pop();

            contain[remC] = false;
            PutBack(remC);

            contain[cC] = true;
            if (!data[i + K]) {
                unused.push(cC);
            }
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 135152 KB Output is correct
2 Incorrect 71 ms 135272 KB Output isn't correct - not an optimal way
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 89 ms 136016 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 169 ms 140496 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 135664 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 192 ms 141216 KB Output isn't correct - not an optimal way
2 Incorrect 190 ms 141344 KB Output isn't correct - not an optimal way
3 Incorrect 193 ms 141552 KB Output isn't correct - not an optimal way
4 Incorrect 186 ms 141552 KB Output isn't correct - not an optimal way
5 Incorrect 190 ms 141296 KB Output isn't correct - not an optimal way
6 Incorrect 195 ms 141552 KB Output isn't correct - not an optimal way
7 Incorrect 190 ms 141552 KB Output isn't correct - not an optimal way
8 Incorrect 198 ms 141440 KB Output isn't correct - not an optimal way
9 Incorrect 214 ms 141376 KB Output isn't correct - not an optimal way
10 Incorrect 197 ms 141552 KB Output isn't correct - not an optimal way