Submission #63008

# Submission time Handle Problem Language Result Execution time Memory
63008 2018-07-31T09:33:58 Z SpaimaCarpatilor Last supper (IOI12_supper) C++17
0 / 100
138 ms 24060 KB
#include "advisor.h"
#include<bits/stdc++.h>

using namespace std;

static int lst[100009];

void ComputeAdvice(int *C, int N, int K, int M)
{
    for (int i=0; i<N; i++)
        lst[i] = -1;
    for (int i=0; i<N; i++)
        lst[C[i]] = i;
    for (int i=0; i<K; i++)
        WriteAdvice (lst[i] == -1);
    for (int j=0; j<N; j++)
        WriteAdvice (lst[C[j]] == j);
}
#include "assistant.h"
#include<bits/stdc++.h>

using namespace std;

static bool ap[100009], dispensable[100009];
static queue < int > canDispense;
static set < int > inSet;

void Assist(unsigned char *A, int N, int K, int R)
{
    for (int i=0; i<K; i++)
    {
        ap[i] = 1,
        dispensable[i] = A[i];
        if (dispensable[i])
            canDispense.push (i);
        else
            inSet.insert (i);
    }
    for (int i = 0; i < N; i++)
    {
        int req = GetRequest();
        if (ap[req])
        {
            if (A[K + i])
                dispensable[req] = 1, canDispense.push (req), inSet.erase (req);
            continue;
        }
        if (!canDispense.empty ())
        {
            int c = canDispense.front ();
            canDispense.pop ();
            ap[c] = 0;
            PutBack (c);
        }
        else
        {
            auto it = inSet.begin ();
            int c = *it;
            inSet.erase (it);
            ap[c] = 0;
            PutBack (c);
        }
        if (A[K + i])
            dispensable[req] = ap[req] = 1, canDispense.push (req);
        else
            ap[req] = 1, inSet.insert (req);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 620 KB Output is correct
2 Correct 6 ms 864 KB Output is correct
3 Correct 6 ms 1152 KB Output is correct
4 Incorrect 9 ms 1536 KB Output isn't correct - not an optimal way
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 1848 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 102 ms 5908 KB Output is correct
2 Correct 103 ms 8264 KB Output is correct
3 Correct 98 ms 9796 KB Output is correct
4 Correct 97 ms 10840 KB Output is correct
5 Incorrect 117 ms 11784 KB Output isn't correct - not an optimal way
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 10 ms 12248 KB Output is correct
2 Correct 12 ms 12248 KB Output is correct
3 Incorrect 7 ms 12248 KB Output isn't correct - not an optimal way
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 13036 KB Output isn't correct - not an optimal way
2 Correct 98 ms 14496 KB Output is correct - 122000 bits used
3 Correct 137 ms 15748 KB Output is correct - 125000 bits used
4 Correct 97 ms 17020 KB Output is correct - 125000 bits used
5 Correct 109 ms 18172 KB Output is correct - 125000 bits used
6 Correct 138 ms 19212 KB Output is correct - 125000 bits used
7 Correct 101 ms 20436 KB Output is correct - 124828 bits used
8 Correct 128 ms 21712 KB Output is correct - 124910 bits used
9 Correct 118 ms 22892 KB Output is correct - 125000 bits used
10 Incorrect 99 ms 24060 KB Output isn't correct - not an optimal way