Submission #928035

# Submission time Handle Problem Language Result Execution time Memory
928035 2024-02-15T18:36:33 Z definitelynotmee Last supper (IOI12_supper) C++17
0 / 100
63 ms 7596 KB
#include "advisor.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define O_O
using namespace std;
template <typename T>
using bstring = basic_string<T>;
template <typename T>
using matrix = vector<vector<T>>;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef double dbl;
typedef long double dbll;
const ll INFL = 4e18+25;
const int INF = 1e9+42;
const double EPS = 1e-7;
const int MOD = 998244353;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
const int MAXN = 1e6+1;

void ComputeAdvice(int *C, int N, int K, int M) {
    
    K = min(K,N);
    vector<int> advice(N+K,1);

    vector<int> last(N,-1);
    iota(last.begin(), last.begin()+K,0);

    vector<int> next(N+K,INF);

    for(int i = 0; i < N; i++){
        if(last[C[i]] != -1)
            next[last[C[i]]] = i+K;
        last[C[i]] = i+K;
    }

    last = vector<int>(N,-1);
    iota(last.begin(), last.begin()+K,0);

    set<pii, greater<pii>> scaff;

    for(int i = 0; i < K; i++){
        scaff.insert({next[i], i});
    }

    auto pop =[&](){
        pii cur = *scaff.begin();
        scaff.erase(scaff.begin());
        advice[cur.ss] = 0;
    };

    for(int i = 0; i < N; i++){
        if(last[C[i]] != -1 && scaff.count({i+K, last[C[i]]})){
            scaff.erase({i+K, last[C[i]]});
        } else {
            pop();
        }
        scaff.insert({next[i+K], i+K});
        last[C[i]] = i+K;
    }

    for(int i : advice)
        WriteAdvice(i);

}
#include "assistant.h"
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define O_O
using namespace std;
template <typename T>
using bstring = basic_string<T>;
template <typename T>
using matrix = vector<vector<T>>;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef double dbl;
typedef long double dbll;
const ll INFL = 4e18+25;
const int INF = 1e9+42;
const double EPS = 1e-7;
const int MOD = 998244353;
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
const int MAXN = 1e6+1;


void Assist(unsigned char *A, int N, int K, int R) {
    vector<int> todelete;

    for(int i = 0; i < K; i++)
        if(A[i] == 0)
            todelete.push_back(i);
    
    set<int> scaff;

    for(int i = 0; i < K; i++)
        scaff.insert(i);
    
    for(int i = 0; i < N; i++){
        int cur = GetRequest();
        if(scaff.count(cur))
            continue;
        
        scaff.erase(todelete.back());
        PutBack(todelete.back());
        todelete.pop_back();

        if(A[i+K] == 0)
            todelete.push_back(cur);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 792 KB Output is correct
2 Incorrect 0 ms 792 KB Error - Putting back a color when it is already on the scaffold
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1128 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 56 ms 5664 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 3 ms 812 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 60 ms 6088 KB Error - Putting back a color when it is already on the scaffold
2 Incorrect 63 ms 6124 KB Error - Putting back a color when it is already on the scaffold
3 Incorrect 63 ms 6620 KB Error - Putting back a color when it is already on the scaffold
4 Incorrect 62 ms 6268 KB Error - Putting back a color when it is already on the scaffold
5 Incorrect 62 ms 6408 KB Error - Putting back a color when it is already on the scaffold
6 Incorrect 62 ms 6612 KB Error - Putting back a color when it is already on the scaffold
7 Incorrect 61 ms 6280 KB Error - Putting back a color when it is already on the scaffold
8 Incorrect 62 ms 6172 KB Error - Putting back a color when it is already on the scaffold
9 Incorrect 62 ms 6264 KB Error - Putting back a color when it is already on the scaffold
10 Incorrect 53 ms 7596 KB Error - Putting back a color that is not on the scaffold