Submission #888738

# Submission time Handle Problem Language Result Execution time Memory
888738 2023-12-18T07:06:59 Z abcvuitunggio Last supper (IOI12_supper) C++17
0 / 100
86 ms 12636 KB
#include "advisor.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> pos[100001];
int a[125001],b[100001],c[100001];
set <pair <int, int>> s;
void ComputeAdvice(int *C, int N, int K, int M){
    for (int i=0;i<N;i++)
        pos[i].push_back(1000000);
    for (int i=N-1;i>=0;i--)
        pos[C[i]].push_back(i+K);
    for (int i=0;i<K;i++){
        b[i]=i;
        c[i]=1;
        s.insert({pos[i].back(),i});
        pos[i].pop_back();
    }
    for (int i=0;i<N;i++){
        if (c[C[i]]){
            a[b[C[i]]]=1;
            b[C[i]]=i;
            continue;
        }
        b[C[i]]=i;
        auto [x,y]=*--s.end();
        s.erase(--s.end());
        c[C[i]]=1;
        c[y]=0;
        s.insert({pos[C[i]].back(),C[i]});
        pos[C[i]].pop_back();
    }
    for (auto [x,y]:s)
        a[b[y]]=1;
    for (int i=0;i<N+K;i++)
        WriteAdvice(a[i]);
}
#include "assistant.h"
#include <bits/stdc++.h>
using namespace std;
int ch[100001];
void Assist(unsigned char *A, int N, int K, int R){
    vector <int> ve;
    for (int i=0;i<K;i++){
        if (!A[i])
            ve.push_back(i);
        ch[i]=1;
    }
    for (int i=0;i<N;i++){
        int c=GetRequest();
        if (!ch[c]){
            PutBack(ve.back());
            ch[ve.back()]=0;
            ch[c]=1;
            ve.pop_back();
        }
        if (!A[i+K])
            ve.push_back(c);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4112 KB Output is correct
2 Runtime error 3 ms 4116 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 8 ms 5220 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 56 ms 10888 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 4860 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 59 ms 12096 KB Execution killed with signal 11
2 Runtime error 79 ms 12284 KB Execution killed with signal 11
3 Runtime error 60 ms 12388 KB Execution killed with signal 11
4 Runtime error 63 ms 12436 KB Execution killed with signal 11
5 Runtime error 68 ms 12528 KB Execution killed with signal 11
6 Runtime error 66 ms 12284 KB Execution killed with signal 11
7 Runtime error 81 ms 12424 KB Execution killed with signal 11
8 Runtime error 84 ms 12636 KB Execution killed with signal 11
9 Runtime error 86 ms 12488 KB Execution killed with signal 11
10 Incorrect 80 ms 12184 KB Output isn't correct - not an optimal way