답안 #928038

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
928038 2024-02-15T18:37:47 Z definitelynotmee 최후의 만찬 (IOI12_supper) C++17
0 / 100
78 ms 6552 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.insert(cur);
        
        scaff.erase(todelete.back());
        PutBack(todelete.back());
        todelete.pop_back();
        if(A[i+K] == 0)
            todelete.push_back(cur);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 792 KB Output is correct
2 Incorrect 0 ms 792 KB Error - Putting back a color that is not on the scaffold
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1120 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 5152 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 808 KB Error - Putting back a color that is not on the scaffold
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 63 ms 5852 KB Error - Putting back a color that is not on the scaffold
2 Incorrect 65 ms 6012 KB Error - Putting back a color that is not on the scaffold
3 Incorrect 70 ms 6552 KB Error - Putting back a color that is not on the scaffold
4 Incorrect 71 ms 6264 KB Error - Putting back a color that is not on the scaffold
5 Incorrect 78 ms 6352 KB Error - Putting back a color that is not on the scaffold
6 Incorrect 70 ms 6268 KB Error - Putting back a color that is not on the scaffold
7 Incorrect 66 ms 6372 KB Error - Putting back a color that is not on the scaffold
8 Incorrect 66 ms 6264 KB Error - Putting back a color that is not on the scaffold
9 Incorrect 68 ms 6376 KB Error - Putting back a color that is not on the scaffold
10 Incorrect 62 ms 6300 KB Error - Putting back a color that is not on the scaffold