답안 #851193

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851193 2023-09-18T19:58:24 Z epicci23 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,0);
    
    map<int,int> go;

    ans[0]=ask(1);

    for(int i=0;i<7;i++){
       vector<int> cur;
       for(int j=2;j<=n;j++){
       	  if(j>>i&1) cur.pb(j);
       }

       map<int,int> mp2,mp3;

       vector<int> gg=get_pairwise_xor(cur);

       for(int x:gg) mp2[x]++;
       
       for(int j=0;j<sz(cur);j++) mp2[0]--;

       for(auto& x:mp2) x.ss/=2;

       cur.pb(1);

       gg=get_pairwise_xor(cur);

       for(int x:gg) mp3[x]++;
       
       for(int j=0;j<sz(cur);j++) mp3[0]--;

       for(auto& x:mp3) x.ss/=2;

       for(auto x:mp2) mp3[x.ff]-=x.ss;

       for(auto x:mp3){
       	  if(x.ss){
       	  	go[x.ff^ans[0]]|=1LL<<i;
       	  }
       }
    }
    
    for(auto x:go) ans[x.ss-1]=x.ff;

	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:15:26: error: 'class std::vector<int>' has no member named 'pb'
   15 |           if(j>>i&1) cur.pb(j);
      |                          ^~
Xoractive.cpp:24:22: error: 'sz' was not declared in this scope
   24 |        for(int j=0;j<sz(cur);j++) mp2[0]--;
      |                      ^~
Xoractive.cpp:26:27: error: 'struct std::pair<const int, int>' has no member named 'ss'
   26 |        for(auto& x:mp2) x.ss/=2;
      |                           ^~
Xoractive.cpp:28:12: error: 'class std::vector<int>' has no member named 'pb'
   28 |        cur.pb(1);
      |            ^~
Xoractive.cpp:34:22: error: 'sz' was not declared in this scope
   34 |        for(int j=0;j<sz(cur);j++) mp3[0]--;
      |                      ^~
Xoractive.cpp:36:27: error: 'struct std::pair<const int, int>' has no member named 'ss'
   36 |        for(auto& x:mp3) x.ss/=2;
      |                           ^~
Xoractive.cpp:38:30: error: 'struct std::pair<const int, int>' has no member named 'ff'
   38 |        for(auto x:mp2) mp3[x.ff]-=x.ss;
      |                              ^~
Xoractive.cpp:38:37: error: 'struct std::pair<const int, int>' has no member named 'ss'
   38 |        for(auto x:mp2) mp3[x.ff]-=x.ss;
      |                                     ^~
Xoractive.cpp:41:16: error: 'struct std::pair<const int, int>' has no member named 'ss'
   41 |           if(x.ss){
      |                ^~
Xoractive.cpp:42:17: error: 'struct std::pair<const int, int>' has no member named 'ff'
   42 |            go[x.ff^ans[0]]|=1LL<<i;
      |                 ^~
Xoractive.cpp:47:26: error: 'struct std::pair<const int, int>' has no member named 'ss'
   47 |     for(auto x:go) ans[x.ss-1]=x.ff;
      |                          ^~
Xoractive.cpp:47:34: error: 'struct std::pair<const int, int>' has no member named 'ff'
   47 |     for(auto x:go) ans[x.ss-1]=x.ff;
      |                                  ^~