답안 #271192

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
271192 2020-08-18T05:02:50 Z 반딧불(#5113) 최후의 만찬 (IOI12_supper) C++14
17 / 100
546 ms 31024 KB
#include <bits/stdc++.h>
#include "advisor.h"

using namespace std;

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];
}

void ComputeAdvice(int *ARR, int N, int K, int M){
    n = N, k = K, m = M;
    if(n<=5000) b=13; else b=20;
    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});
    }

    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] = tmp.second;
        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 "assistant.h"

using namespace std;

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

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

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

        if(tmp != n) PutBack(tmp);
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 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 16 ms 5888 KB Output is correct
5 Correct 22 ms 6464 KB Output is correct
6 Correct 22 ms 6400 KB Output is correct
7 Correct 24 ms 6656 KB Output is correct
8 Correct 20 ms 6400 KB Output is correct
9 Correct 20 ms 6400 KB Output is correct
10 Correct 20 ms 6400 KB Output is correct
11 Correct 22 ms 6400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 7928 KB Output is correct
2 Correct 275 ms 18160 KB Output is correct
3 Correct 546 ms 30996 KB Output is correct
4 Correct 520 ms 30264 KB Output is correct
5 Correct 537 ms 30340 KB Output is correct
6 Correct 520 ms 30908 KB Output is correct
7 Correct 544 ms 31024 KB Output is correct
8 Correct 437 ms 26600 KB Output is correct
9 Correct 503 ms 30400 KB Output is correct
10 Correct 514 ms 31004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 50 ms 16608 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 5888 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 65 ms 18912 KB Error - advice is too long
2 Incorrect 66 ms 19080 KB Error - advice is too long
3 Incorrect 65 ms 19168 KB Error - advice is too long
4 Incorrect 66 ms 19160 KB Error - advice is too long
5 Incorrect 68 ms 19168 KB Error - advice is too long
6 Incorrect 68 ms 19168 KB Error - advice is too long
7 Incorrect 73 ms 19168 KB Error - advice is too long
8 Incorrect 79 ms 19168 KB Error - advice is too long
9 Incorrect 67 ms 19168 KB Error - advice is too long
10 Incorrect 79 ms 18664 KB Error - advice is too long