답안 #851192

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851192 2023-09-18T19:57:30 Z epicci23 Xoractive (IZhO19_xoractive) C++17
컴파일 오류
0 ms 0 KB
#include "interactive.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:7:5: error: 'map' was not declared in this scope
    7 |     map<int,int> go;
      |     ^~~
Xoractive.cpp:2:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    1 | #include "interactive.h"
  +++ |+#include <map>
    2 | using namespace std;
Xoractive.cpp:7:9: error: expected primary-expression before 'int'
    7 |     map<int,int> go;
      |         ^~~
Xoractive.cpp:14:26: error: 'class std::vector<int>' has no member named 'pb'
   14 |           if(j>>i&1) cur.pb(j);
      |                          ^~
Xoractive.cpp:17:12: error: expected primary-expression before 'int'
   17 |        map<int,int> mp2,mp3;
      |            ^~~
Xoractive.cpp:21:22: error: 'mp2' was not declared in this scope
   21 |        for(int x:gg) mp2[x]++;
      |                      ^~~
Xoractive.cpp:23:22: error: 'sz' was not declared in this scope
   23 |        for(int j=0;j<sz(cur);j++) mp2[0]--;
      |                      ^~
Xoractive.cpp:23:35: error: 'mp2' was not declared in this scope
   23 |        for(int j=0;j<sz(cur);j++) mp2[0]--;
      |                                   ^~~
Xoractive.cpp:25:20: error: 'mp2' was not declared in this scope
   25 |        for(auto& x:mp2) x.ss/=2;
      |                    ^~~
Xoractive.cpp:27:12: error: 'class std::vector<int>' has no member named 'pb'
   27 |        cur.pb(1);
      |            ^~
Xoractive.cpp:31:22: error: 'mp3' was not declared in this scope
   31 |        for(int x:gg) mp3[x]++;
      |                      ^~~
Xoractive.cpp:33:22: error: 'sz' was not declared in this scope
   33 |        for(int j=0;j<sz(cur);j++) mp3[0]--;
      |                      ^~
Xoractive.cpp:33:35: error: 'mp3' was not declared in this scope
   33 |        for(int j=0;j<sz(cur);j++) mp3[0]--;
      |                                   ^~~
Xoractive.cpp:35:20: error: 'mp3' was not declared in this scope
   35 |        for(auto& x:mp3) x.ss/=2;
      |                    ^~~
Xoractive.cpp:37:19: error: 'mp2' was not declared in this scope
   37 |        for(auto x:mp2) mp3[x.ff]-=x.ss;
      |                   ^~~
Xoractive.cpp:37:24: error: 'mp3' was not declared in this scope
   37 |        for(auto x:mp2) mp3[x.ff]-=x.ss;
      |                        ^~~
Xoractive.cpp:39:19: error: 'mp3' was not declared in this scope
   39 |        for(auto x:mp3){
      |                   ^~~
Xoractive.cpp:41:12: error: 'go' was not declared in this scope; did you mean 'gg'?
   41 |            go[x.ff^ans[0]]|=1LL<<i;
      |            ^~
      |            gg
Xoractive.cpp:46:16: error: 'go' was not declared in this scope
   46 |     for(auto x:go) ans[x.ss-1]=x.ff;
      |                ^~