답안 #812796

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
812796 2023-08-07T11:05:32 Z Andrey 최후의 만찬 (IOI12_supper) C++14
20 / 100
315 ms 19784 KB
#include<bits/stdc++.h>
#include "advisor.h"
using namespace std;

vector<int> haha[100001];
void ComputeAdvice(int *c, int n, int k, int m) {
    int br = 0,z = 1;
    while(z <= n) {
        z*=2;
        br++;
    }
    vector<int> ans(0);
    vector<int> p(n);
    vector<bool> bruh(n);
    int a,b;
    priority_queue<pair<int,int>> idk;
    for(int i = 0; i < n; i++) {
        haha[c[i]].push_back(i);
    }
    for(int i = 0; i < n; i++) {
        haha[i].push_back(INT_MAX);
    }
    for(int i = 0; i < k; i++) {
        bruh[i] = true;
        idk.push({haha[i][0],i});
    }
    for(int i = 0; i < n; i++) {
        if(bruh[c[i]]) {
            p[c[i]]++;
            idk.push({haha[c[i]][p[c[i]]],c[i]});
            ans.push_back(INT_MAX);
        }
        else {
            a = idk.top().first;
            b = idk.top().second;
            bruh[b] = false;
            idk.pop();
            ans.push_back(b);
            p[c[i]]++;
            idk.push({haha[c[i]][p[c[i]]],c[i]});
            bruh[c[i]] = true;
        }
    }
    for(int i = 0; i < n; i++) {
        for(int j = br-1; j >= 0; j--) {
            if((1 << j)&ans[i]) {
                WriteAdvice(1);
            }
            else {
                WriteAdvice(0);
            }
        }
    }
}
#include<bits/stdc++.h>
#include "assistant.h"
using namespace std;

void Assist(unsigned char *a, int n, int k, int r) {
    int br = 0,z = 1,x = 0;
    while(z <= n) {
        z*=2;
        br++;
    }
    int y = 0;
    for(int i = 0; i < n; i++) {
        GetRequest();
        x = 0;
        for(int j = 0; j < br; j++) {
            x*=2;
            x+=(int)a[y];
            y++;
        }
        if(x < n) {
            PutBack(x);
        }
    }
}

Compilation message

advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:15:9: warning: variable 'a' set but not used [-Wunused-but-set-variable]
   15 |     int a,b;
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2960 KB Output is correct
2 Correct 2 ms 2956 KB Output is correct
3 Correct 4 ms 2984 KB Output is correct
4 Correct 8 ms 3432 KB Output is correct
5 Correct 13 ms 3636 KB Output is correct
6 Correct 13 ms 3644 KB Output is correct
7 Correct 13 ms 3764 KB Output is correct
8 Correct 13 ms 3680 KB Output is correct
9 Correct 13 ms 3772 KB Output is correct
10 Correct 15 ms 3776 KB Output is correct
11 Correct 13 ms 3728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 4496 KB Output is correct
2 Correct 141 ms 11004 KB Output is correct
3 Correct 293 ms 19524 KB Output is correct
4 Correct 312 ms 19584 KB Output is correct
5 Correct 298 ms 19632 KB Output is correct
6 Correct 305 ms 19452 KB Output is correct
7 Correct 294 ms 19492 KB Output is correct
8 Correct 259 ms 17060 KB Output is correct
9 Correct 304 ms 19784 KB Output is correct
10 Correct 295 ms 19476 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 237 ms 15332 KB Output is correct
2 Incorrect 35 ms 10564 KB Error - advice is too long
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 3076 KB Error - advice is too long
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 303 ms 18344 KB Output is partially correct - 1700000 bits used
2 Correct 295 ms 18380 KB Output is partially correct - 1700000 bits used
3 Correct 307 ms 18416 KB Output is partially correct - 1700000 bits used
4 Correct 294 ms 18296 KB Output is partially correct - 1700000 bits used
5 Correct 298 ms 18392 KB Output is partially correct - 1700000 bits used
6 Correct 292 ms 18356 KB Output is partially correct - 1700000 bits used
7 Correct 315 ms 18340 KB Output is partially correct - 1697263 bits used
8 Correct 297 ms 18436 KB Output is partially correct - 1700000 bits used
9 Correct 307 ms 18372 KB Output is partially correct - 1700000 bits used
10 Correct 301 ms 18460 KB Output is partially correct - 1700000 bits used