답안 #551508

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
551508 2022-04-20T22:15:43 Z Olympia Xoractive (IZhO19_xoractive) C++17
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <map>
#include <complex>
#include <cmath>
#include <stdio.h>
#include <string.h>
#include <set>
#include <queue>
#include"interactive.h"
using namespace std;

vector<int> reduce (vector<int> v) {
    map<int,int> cnt;
    for (int i: v) {
        cnt[i]++;
    }
    cnt[0] = 0;
    v.clear();
    for (auto& p: cnt) {
        p.second /= 2;
        while (p.second--) {
            v.push_back(p.first);
        }
    }
    return v;
}
int beginning;
vector<int> permutation (vector<int> indices, int n) {
    vector<int> v1 = reduce(get_pairwise_xor(indices));
    indices.push_back(n - 1);
    vector<int> v2 = reduce(get_pairwise_xor(indices));
    map<int,int> cnt;
    for (int i: v2) cnt[i]++;
    for (int i: v1) cnt[i]--;
    vector<int> v;
    for (auto& p: cnt) {
        if (p.second)
        v.push_back(p.first ^ beginning);
    }
    sort(v.begin(), v.end());
    return v;
}
vector<int> solve (int n) {
    beginning = ask(n);
    map<int,int> m;
    for (int i = 0; i < 7; i++) {
        vector<int> x;
        for (int j = 0; j < n - 1; j++) {
            if ((j + 1) & (1 << i)) {
                x.push_back(j + 1);
            }
        }
        vector<int> a = permutation(x, n);
        for (int val: a) {
            m[val] |= (1 << i);
        }
    }
    vector<int> ans(n);
    for (auto& p: m) {
        ans[p.second - 1] = p.first;
    }
    return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccCj04uy.o: in function `main':
grader.cpp:(.text.startup+0xdc): undefined reference to `guess(int)'
collect2: error: ld returned 1 exit status