답안 #521914

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521914 2022-02-03T12:44:10 Z dostigator Xoractive (IZhO19_xoractive) C++17
컴파일 오류
0 ms 0 KB
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> guess(int n) {
	vector <int> ans(n+2);
	int base=ask(1);
	ans[1]=base;
	map<int,int>res;
	for(int i=0; i<7; ++i){
        vector<int>v;
        for(int x=1; x<=n; ++x) if((x>>i)&1) v.push_back(x);
        vector<int>get=get_pairwise_xor(v);
        v.push_back(1);
        vector<int>GET=get_pairwise_xor(v);
        map<int,int>mp;
        for(int x:get) mp[x]++;
        for(int x:GET){
            if(mp[x]==0) res[x^base]|=(1<<i);
            mp[x]--;
        }
	}
	for(int [x:y]:res){
        ans[y]=x;
	}
	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:23:12: error: expected ']' before ':' token
   23 |  for(int [x:y]:res){
      |            ^
      |            ]
Xoractive.cpp:23:10: error: structured binding declaration cannot have type 'int'
   23 |  for(int [x:y]:res){
      |          ^
Xoractive.cpp:23:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
Xoractive.cpp:23:10: error: only 1 name provided for structured binding
Xoractive.cpp:23:10: note: while 'std::pair<const int, int>' decomposes into 2 elements
Xoractive.cpp:24:13: error: 'y' was not declared in this scope
   24 |         ans[y]=x;
      |             ^