답안 #256259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
256259 2020-08-02T12:39:09 Z Akashi 최후의 만찬 (IOI12_supper) C++14
0 / 100
447 ms 17400 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;

void ComputeAdvice(int *C, int N, int K, int M) {

    vector <int> ap(N, N);
    vector <int> Next(N, N);
    for (int i = N - 1; i >= 0 ; --i) {
        Next[i] = ap[C[i]];
        ap[C[i]] = i;
    }

    vector <bool> adv(M, 1);

    set <pair <int, int> > s;
    vector <bool> f(N, 0);

    for (int i = 0; i < K ; ++i) {
        s.insert({ap[i], i});
        f[i] = 1;
    }

    for (int i = 0; i < N ; ++i) {
        if (f[C[i]] == 1) {
            set <pair <int, int> > :: iterator it = s.lower_bound({i, 0});
            s.erase(it);
        } else {
            ///trebuie sa scot o culoare de pe paleta
            set <pair <int, int> > :: reverse_iterator it = s.rbegin();
            adv[it->second] = 0;
            if (it->second < K) f[K] = 0;
            else f[C[it->second - K]] = 0;
            s.erase(*it);
        }

        f[C[i]] = 1;
        s.insert({Next[i], i + K});
    }

    for (auto it : adv) WriteAdvice(it);

    return ;
}

#include <bits/stdc++.h>
#include "assistant.h"
using namespace std;

void Assist(unsigned char *A, int N, int K, int R) {
    vector <bool> f(N, 0);
    vector <int> rec;

    int ind = 0;
    for (int i = 0; i < K ; ++i, ++ind) {
        if (A[ind] == 0) rec.push_back(i);
        f[i] = 1;
    }

    for (int i = 0; i < N ; ++i, ++ind) {
        int req = GetRequest();
        if (!f[req]) {
            f[req] = 1;
            f[rec.back()] = 0;
            PutBack(rec.back());
            rec.pop_back();
        }

        if (A[ind] == 0) rec.push_back(req);
    }

    return ;
}
/**
4 2 65000
2 0 3 0
**/
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 1032 KB Output is correct
2 Correct 14 ms 1032 KB Output is correct
3 Correct 15 ms 1172 KB Output is correct
4 Correct 15 ms 1280 KB Output is correct
5 Incorrect 16 ms 1348 KB Error - Putting back a color that is not on the scaffold
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 390 ms 13320 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 350 ms 13960 KB Output is correct
2 Correct 376 ms 14944 KB Output is correct
3 Correct 373 ms 15200 KB Output is correct
4 Correct 367 ms 15192 KB Output is correct
5 Incorrect 363 ms 14696 KB Error - Putting back a color that is not on the scaffold
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1184 KB Output is correct
2 Correct 6 ms 1024 KB Output is correct
3 Correct 6 ms 1228 KB Output is correct
4 Incorrect 6 ms 1236 KB Error - Putting back a color that is not on the scaffold
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 440 ms 16656 KB Error - Putting back a color that is not on the scaffold
2 Correct 429 ms 16656 KB Output is partially correct - 1800000 bits used
3 Correct 427 ms 16912 KB Output is partially correct - 1800000 bits used
4 Correct 424 ms 17400 KB Output is partially correct - 1800000 bits used
5 Correct 433 ms 16920 KB Output is partially correct - 1800000 bits used
6 Correct 447 ms 16920 KB Output is partially correct - 1800000 bits used
7 Correct 429 ms 16912 KB Output is partially correct - 1800000 bits used
8 Correct 435 ms 16920 KB Output is partially correct - 1800000 bits used
9 Correct 422 ms 16928 KB Output is partially correct - 1800000 bits used
10 Correct 422 ms 16912 KB Output is partially correct - 1800000 bits used