답안 #169169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
169169 2019-12-18T19:00:37 Z RafaelSus Xoractive (IZhO19_xoractive) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
const int N = 5e5 + 5;
typedef long long ll;
#define pb push_back


int[] guess(int n){
  int res[n],p=0;
  if(n<=4){
    for(int i=0;i<n;i++)
      res[i]=ask(i+1);
    return res;
  }
  res[0]=ask(1);
  vector<int>idx[7][3];
  for(int i=2;i<=n;i++){
    for(int j=0;j<=6;j++){
      idx[j][(i>>j)%2].push_back(i);
    }
  }
  vector<int>a[7];
  set<int>all;
  set<int>h[7][2];
  for(int i=0;i<=6;i++){
    vector<int>v1=get_pairwise_xor(idx[i][1]);
    idx[i][1].push_back(1);
    vector<int>v2=get_pairwise_xor(idx[i][1]);
    idx[i][1].pop_back();
    multiset<int>fi,se;
    for(int i=0;i<v1.size();i++)fi.insert(v1[i]);
    for(int i=0;i<v2.size();i++)se.insert(v2[i]);
    for(auto x:fi)
      se.erase(se.find(x));
    vector<int>tmp;
    for(auto x:se)
      tmp.insert(x^res[0]);
    tmp.erase(res[0]);
    for(auto x:tmp)
      all.insert(x);
    h[i][1]=tmp;
  }
  for(int i=0;i<=6;i++){
    h[i][0]=all;
    for(auto x:h[i][1])
      h[i][0].erase(x);
  }
  for(int i=2;i<=n;i++){
    set<int>tmp=all;
    for(int j=0;j<=6;j++){
      for(auto x:all){
        if(h[j][(i>>j)%2].find(x)==h[j][(i>>j)%2].end())
          tmp.erase(x);
      }
    }
    res[i-1]=*tmp.begin();
  }
  return res;
}

Compilation message

Xoractive.cpp:9:4: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
 int[] guess(int n){
    ^
Xoractive.cpp:9:4: error: decomposition declaration cannot be declared with type 'int'
 int[] guess(int n){
    ^~
Xoractive.cpp:9:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
Xoractive.cpp:9:4: error: empty decomposition declaration
Xoractive.cpp:9:7: error: expected initializer before 'guess'
 int[] guess(int n){
       ^~~~~