답안 #208348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
208348 2020-03-10T21:47:50 Z MetB Xoractive (IZhO19_xoractive) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;

#define N 2000001

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll INF = 1e18, MOD = 1e9 + 7, MOD2 = 1e6 + 3;

map <int, int> ind;

vector <int> guess () {
	cin >> n;

	int d = ask (1);

	for (int b = 0; b < 7; b++) {
		vector <int> v;

		for (int i = 2; i <= n; i++) {
			if (i & (1 << b)) v.push_back (i);
		}

		vector <int> ans = get_pairwise_xor (v);
		v.push_back (1);
		vector <int> ans2 = get_pairwise_xor (v);

		for (int a : ans)
			ans2.erase (find (ans.begin (), ans.end (), a));

		sort (ans2.begin(), ans2.end());

		for (int i = 1; i < ans2.size (); i += 2) {
			ind[ans2[i] ^ d] |= (1 << d);
		}
	}

	vector <int> ans (n);

	ans[0] = d;

	for (auto x : ind) {
		ans[ind.second] = ind.first;
	}

	return ans;
}

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess()':
Xoractive.cpp:18:9: error: 'n' was not declared in this scope
  cin >> n;
         ^
Xoractive.cpp:18:9: note: suggested alternative: 'yn'
  cin >> n;
         ^
         yn
Xoractive.cpp:20:10: error: 'ask' was not declared in this scope
  int d = ask (1);
          ^~~
Xoractive.cpp:29:22: error: 'get_pairwise_xor' was not declared in this scope
   vector <int> ans = get_pairwise_xor (v);
                      ^~~~~~~~~~~~~~~~
Xoractive.cpp:38:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 1; i < ans2.size (); i += 2) {
                   ~~^~~~~~~~~~~~~~
Xoractive.cpp:48:11: error: 'class std::map<int, int>' has no member named 'second'; did you mean 'cend'?
   ans[ind.second] = ind.first;
           ^~~~~~
           cend
Xoractive.cpp:48:25: error: 'class std::map<int, int>' has no member named 'first'
   ans[ind.second] = ind.first;
                         ^~~~~