답안 #1011749

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1011749 2024-07-01T07:59:44 Z vjudge1 마술쇼 (APIO24_show) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
set<int> v[5000];
vector<int> VV(4999),v2[5000];
int capacity[5000],given[5000];
mt19937 rng(1987042837);
void gen(){
    int sum=0;
    for(int i=2;i<5000;i++)
        sum+=capacity[i]=log2(i-1);
    sum/=60;
    vector<int>Z(60),Z2(4998);
    iota(Z.begin(),Z.end(),0);
    iota(Z2.begin(),Z2.end(),2);
    iota(VV.begin(),VV.end(),1);
    shuffle(Z.begin(),Z.end(),rng);
    shuffle(VV.begin(),VV.end(),rng);
    for(auto j:Z){
        int x=sum;
        shuffle(Z2.begin(),Z2.end(),rng);
        for(auto i:Z2)if(capacity[i]*!v[i].count(j)*x)
            capacity[i]--,v[i].insert(j),x--;
    }
    for(auto i:Z2)while(capacity[i]){
        vector<int>VVV(60);
        iota(VVV.begin(),VVV.end(),0);
        shuffle(VVV.begin(),VVV.end(),rng);
        int x=-1;
        for(auto j:VVV)
            if(!v[i].count(j)){
                x=j;
                break;
            }
        v[i].insert(x);
        capacity[i]--;
    }
    for(auto i:Z2)
        for(auto j:v[i])
            v2[i].push_back(j);
    for(auto i:Z2)shuffle(v2[i].begin(),v2[i].end(),rng);
}
std::vector<std::pair<int,int>> Alice(){
    gen();
    long long x=setN(4999);
    vector<pair<int,int>>ans;
    for(int i=2;i<5e3;i++)for(auto j:v2[i])
        given[i]=given[i]*2+(x>>j&1);
    for(int i=2;i<5e3;i++){
        int a=VV[given[i]],b=VV[i-1];
        if(rng()%2)
            swap(a,b);
        ans.push_back({a,b});
    }
    shuffle(ans.begin(),ans.end(),rng);
    return ans;
}



    

Compilation message

Alice.cpp: In function 'void gen()':
Alice.cpp:24:52: warning: '*' in boolean context, suggest '&&' instead [-Wint-in-bool-context]
   24 |         for(auto i:Z2)if(capacity[i]*!v[i].count(j)*x)
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~

/usr/bin/ld: /tmp/ccrBKYFh.o: in function `main':
grader_bob.cpp:(.text.startup+0x324): undefined reference to `Bob(std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > >)'
collect2: error: ld returned 1 exit status