Submission #272083

# Submission time Handle Problem Language Result Execution time Memory
272083 2020-08-18T08:47:26 Z 반딧불(#5113) Last supper (IOI12_supper) C++14
20 / 100
624 ms 29912 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "advisor.h"

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> idx_set;

namespace{
    int n, k, m, b;
    int arr[100002];
    int ans[100002];

    bool chk[100002];
    priority_queue<pair<int, int> > pq;
    vector<int> times[100002];

    idx_set st;
}

void ComputeAdvice(int *ARR, int N, int K, int M){
    n = N, k = K, m = M;
    if(n<=5000) b=13; else b=17;
    for(int i=0; i<n; i++){
        arr[i] = ARR[i];
        times[arr[i]].push_back(i);
    }
    for(int i=0; i<n; i++) times[i].push_back(1e9);
    for(int i=0; i<n; i++){
        reverse(times[i].begin(), times[i].end());
        if(i<k) pq.push({times[i].back(), i}), st.insert(i);
    }

    for(int i=0; i<k; i++) chk[i] = 1;
    for(int i=0; i<n; i++){
        times[arr[i]].pop_back();
        if(chk[arr[i]]){
            ans[i] = n;
            pq.push({times[arr[i]].back(), arr[i]});
            continue;
        }

        pair<int, int> tmp = pq.top(); pq.pop();
        ans[i] = st.order_of_key(tmp.second);
        st.erase(tmp.second);
        st.insert(arr[i]);
        chk[tmp.second] = 0;
        pq.push({times[arr[i]].back(), arr[i]});
        chk[arr[i]] = 1;
    }

    for(int i=0; i<n; i++){
        for(int j=0; j<b; j++){
            WriteAdvice(!!(ans[i] & (1<<j)));
        }
    }
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "assistant.h"

using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> idx_set;

namespace{
    int n, k, l, b;
    int arr[2000002];
    idx_set st;
}

void Assist(unsigned char *ARR, int N, int K, int R) {
    n = N, k = K, l = R;
    if(n<=5000) b=13; else b=17;
    for(int i=0; i<R; i++) arr[i] = ARR[i];

    for(int i=0; i<k; i++){
        st.insert(i);
    }

    for(int i=0; i<n; i++){
        int tpt = GetRequest();
        int tmp = 0;
        for(int j=0; j<b; j++){
            tmp += (1<<j) * arr[i*b+j];
        }

        if(tmp != n){
            int tx = *st.find_by_order(tmp);
            PutBack(tx);
            st.erase(tx);
            st.insert(tpt);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 5376 KB Output is correct
2 Correct 4 ms 5376 KB Output is correct
3 Correct 6 ms 5632 KB Output is correct
4 Correct 13 ms 5888 KB Output is correct
5 Correct 22 ms 6144 KB Output is correct
6 Correct 26 ms 6144 KB Output is correct
7 Correct 23 ms 6400 KB Output is correct
8 Correct 25 ms 6400 KB Output is correct
9 Correct 24 ms 6400 KB Output is correct
10 Correct 28 ms 6640 KB Output is correct
11 Correct 27 ms 6400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 7672 KB Output is correct
2 Correct 276 ms 17008 KB Output is correct
3 Correct 624 ms 29912 KB Output is correct
4 Correct 480 ms 26304 KB Output is correct
5 Correct 517 ms 26272 KB Output is correct
6 Correct 523 ms 27272 KB Output is correct
7 Correct 589 ms 28712 KB Output is correct
8 Correct 523 ms 25568 KB Output is correct
9 Correct 436 ms 26352 KB Output is correct
10 Correct 562 ms 29824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 430 ms 24376 KB Output is correct
2 Incorrect 124 ms 20440 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 5888 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 536 ms 28448 KB Output is partially correct - 1700000 bits used
2 Correct 550 ms 29112 KB Output is partially correct - 1700000 bits used
3 Correct 539 ms 29400 KB Output is partially correct - 1700000 bits used
4 Correct 544 ms 29432 KB Output is partially correct - 1700000 bits used
5 Correct 550 ms 29148 KB Output is partially correct - 1700000 bits used
6 Correct 587 ms 29160 KB Output is partially correct - 1700000 bits used
7 Correct 572 ms 29416 KB Output is partially correct - 1697263 bits used
8 Correct 619 ms 29144 KB Output is partially correct - 1700000 bits used
9 Correct 550 ms 29152 KB Output is partially correct - 1700000 bits used
10 Correct 581 ms 29096 KB Output is partially correct - 1700000 bits used