Submission #157307

# Submission time Handle Problem Language Result Execution time Memory
157307 2019-10-10T14:11:53 Z dolphingarlic Last supper (IOI12_supper) C++14
0 / 100
281 ms 142064 KB
#include "advisor.h"
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
using namespace std;

set<pair<int, int>> scaffold;
queue<int> occurrences[100000];
int swap_sequence[100000];
bool on_scaffold[100000];

void ComputeAdvice(int *C, int N, int K, int M) {
    FOR(i, 0, N) occurrences[C[i]].push(i);
    FOR(i, 0, N) occurrences[i].push(INT_MAX);

    FOR(i, 0, K) scaffold.insert({-occurrences[i].front(), i});

    FOR(i, 0, N) {
        if (on_scaffold[C[i]]) {
            swap_sequence[i] = C[i];
            scaffold.erase({-occurrences[C[i]].front(), C[i]});
        } else {
            swap_sequence[i] = (*scaffold.begin()).second;
            on_scaffold[(*scaffold.begin()).second] = false;
            scaffold.erase(scaffold.begin());
        }
        occurrences[C[i]].pop();
        scaffold.insert({-occurrences[C[i]].front(), C[i]});
        on_scaffold[C[i]] = true;
    }

    FOR(i, 0, N) {
        
    }
}
#include "assistant.h"
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
using namespace std;

set<pair<int, int>> scaffold;
int on_scaffold[100000];

void Assist(unsigned char *A, int N, int K, int R) {
    FOR(i, 0, K) {
        scaffold.insert({A[i] - '0', i});
        on_scaffold[i] = A[i] - '0' + 1;
    }

    FOR(i, K, N + K) {
        int nxt = GetRequest();
        if (on_scaffold[nxt]) {
            scaffold.erase({on_scaffold[nxt] - 1, nxt});
            scaffold.insert({A[i] - '0', nxt});
        } else {
            PutBack((*scaffold.begin()).second);
            on_scaffold[(*scaffold.begin()).second] = 0;
            scaffold.erase(scaffold.begin());
            scaffold.insert({A[i] - '0', nxt});
        }
        on_scaffold[nxt] = A[i] - '0' + 1;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 135152 KB Output isn't correct - not an optimal way
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 136336 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 192 ms 140696 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 135904 KB Error - Putting back a color when it is already on the scaffold
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 225 ms 141664 KB Output isn't correct - not an optimal way
2 Incorrect 225 ms 141432 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 236 ms 141720 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 240 ms 141976 KB Output isn't correct - not an optimal way
5 Incorrect 238 ms 141808 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 231 ms 141808 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 281 ms 141912 KB Output isn't correct - not an optimal way
8 Incorrect 236 ms 141808 KB Output isn't correct - not an optimal way
9 Incorrect 239 ms 141664 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 227 ms 142064 KB Output isn't correct - not an optimal way