Submission #541467

# Submission time Handle Problem Language Result Execution time Memory
541467 2022-03-23T16:26:45 Z MohamedFaresNebili Last supper (IOI12_supper) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "advisor.h"

        using namespace std;

        using ll = long long;
        using ii = pair<ll, ll>;

        #define ff first
        #define ss second
        #define pb push_back
        /// #define int ll

        const int MOD = 1e9 + 7;

        void ComputeAdvice(int C[], int N, int K, int M) {
            int k = ceil(log2(N));

            for(int l = 0; l < N; l++) {
                for(int i = 0; i <= k; i++) {
                    if(C[l] & (1 << i))
                        WriteAdvice(1);
                    else WriteAdvice(0);
                }
            }
        }



#include <bits/stdc++.h>
#pragma GCC optimize ("Ofast")
#pragma GCC target ("avx2")
#include "assistant.h"

        using namespace std;

        using ll = long long;
        using ii = pair<ll, ll>;

        #define ff first
        #define ss second
        #define pb push_back
        /// #define int ll

        const int MOD = 1e9 + 7;

        int arr[5001], pw[31], k;
        vector<int> num[5001];

        int GetRequest();
        void PutBack(int T);

        void Assist(string A, int N, int K, int R) {

            int i; k = ceil(log2(N)); int v = 1;

            for(int l = 0; l <= k; l++)
                pw[l] = v, v *= 2;

            int m = A.size();

            for(int l = 0; l < m; l++) {
                int val = 0;
                for(i = 0; i <= k; i++) {
                    if(A[l + i] == '0') continue;
                    val += pw[k - i];
                }
                arr[val]++; num[val].pb(l); l += k;
            }

            set<int> curr;
            for(int l = 0; l < K; l++) curr.insert(l);
            for (i = 0; i < N; i++) {
                int req = GetRequest();
                if(curr.count(req)) continue;
                int in = -1;
                for(int l = 0; l < N; l++) {
                    if(!curr.count(l)) continue;
                    if(arr[l] == 0) {
                        in = l; break;
                    }
                }
                if(in != -1) {
                    PutBack(in); curr.erase(in);
                    curr.insert(req); arr[req]--; continue;
                }

                int s = -1;
                for(int l = 0; l < N; l++) {
                    if(!curr.count(l)) continue;
                    if(*num[l].begin() > s) {
                        s = *num[l].begin(), in = l;
                    }
                }
                PutBack(in); curr.erase(in);
                curr.insert(req); arr[req]--;
            }

        }

Compilation message

/usr/bin/ld: /tmp/ccvVspD1.o: in function `main':
assistant_grader.cpp:(.text.startup+0x21e): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status