답안 #707372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
707372 2023-03-08T23:40:06 Z beaconmc Xoractive (IZhO19_xoractive) C++14
100 / 100
9 ms 364 KB
#include "interactive.h"

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

typedef int ll;
using namespace std;
//using namespace __gnu_pbds;

#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
//#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)

int one = -1;

vector<int> getxor(vector<int> lis){
	vector<int> ans = get_pairwise_xor(lis);
	vector<int> realans;
	FOR(i,0,ans.size()){
		if (i%2==0) continue;
		if (ans[i] == 0) continue;
		realans.push_back(ans[i]);
	}
	return realans;
}


vector<int> getnum(vector<int> lis){
	vector<int> sus = getxor(lis);
	lis.push_back(1);
	vector<int> sus2 = getxor(lis);
	while (sus.size() != 0){
		FOR(i,0,sus2.size()) if (sus2[i] == sus[sus.size()-1]){sus.pop_back(); sus2[i] = -1;break;}
	}
	vector<int> temp;
	for (auto i : sus2){
		if (i != -1) temp.push_back(i^one);
	}


    return temp;
}
int intersect(vector<vector<int>> idk){
	for (auto&i : idk[0]){
		bool flag = false;
		for (auto&j : idk){
			if (!count(j.begin(),j.end(),i)) flag = true;
		}
		if (!flag) return i;
	}

}

vector<int> imp[8];


vector<int> guess(int n) {
	set<ll> everything;
	one = ask(1);

	FOR(i,2,n+1){
		FOR(j,0,7){
			if (i & (1<<j)) imp[j].push_back(i);
		}
	}


	FOR(i,0,7){
		if (imp[i].size()) imp[i] = getnum(imp[i]);
	}
	for (auto&i : imp){
		for (auto&j : i){
			everything.insert(j);

		}

	}


	imp[0].push_back(one);



	vector<int> ans;
	ans.push_back(one);
	FOR(i,2,n+1){
		vector<vector<int>> temp;
		FOR(j,0,7){
			if (i & (1<<j)) temp.push_back(imp[j]);
			else{
				vector<int> temp2;
				set<ll> idk;
				for (auto&k : imp[j]) idk.insert(k);
				for (auto&k : everything) if (idk.count(k) == 0) temp2.push_back(k);
				temp.push_back(temp2);

			}
		}
		ans.push_back(intersect(temp));
	}
	return ans;


}

Compilation message

Xoractive.cpp: In function 'std::vector<int> getxor(std::vector<int>)':
Xoractive.cpp:11:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   21 |  FOR(i,0,ans.size()){
      |      ~~~~~~~~~~~~~~                
Xoractive.cpp:21:2: note: in expansion of macro 'FOR'
   21 |  FOR(i,0,ans.size()){
      |  ^~~
Xoractive.cpp: In function 'std::vector<int> getnum(std::vector<int>)':
Xoractive.cpp:11:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   35 |   FOR(i,0,sus2.size()) if (sus2[i] == sus[sus.size()-1]){sus.pop_back(); sus2[i] = -1;break;}
      |       ~~~~~~~~~~~~~~~              
Xoractive.cpp:35:3: note: in expansion of macro 'FOR'
   35 |   FOR(i,0,sus2.size()) if (sus2[i] == sus[sus.size()-1]){sus.pop_back(); sus2[i] = -1;break;}
      |   ^~~
Xoractive.cpp: In function 'int intersect(std::vector<std::vector<int> >)':
Xoractive.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 336 KB Output is correct
2 Correct 6 ms 336 KB Output is correct
3 Correct 6 ms 336 KB Output is correct
4 Correct 6 ms 336 KB Output is correct
5 Correct 7 ms 364 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 6 ms 348 KB Output is correct
8 Correct 6 ms 336 KB Output is correct
9 Correct 6 ms 336 KB Output is correct
10 Correct 6 ms 336 KB Output is correct
11 Correct 6 ms 336 KB Output is correct
12 Correct 6 ms 344 KB Output is correct
13 Correct 6 ms 336 KB Output is correct
14 Correct 6 ms 336 KB Output is correct
15 Correct 6 ms 340 KB Output is correct
16 Correct 6 ms 336 KB Output is correct
17 Correct 7 ms 336 KB Output is correct
18 Correct 6 ms 336 KB Output is correct
19 Correct 5 ms 336 KB Output is correct
20 Correct 8 ms 336 KB Output is correct
21 Correct 7 ms 336 KB Output is correct
22 Correct 6 ms 340 KB Output is correct
23 Correct 7 ms 340 KB Output is correct
24 Correct 6 ms 336 KB Output is correct
25 Correct 6 ms 336 KB Output is correct
26 Correct 6 ms 336 KB Output is correct
27 Correct 6 ms 336 KB Output is correct
28 Correct 7 ms 336 KB Output is correct
29 Correct 6 ms 344 KB Output is correct
30 Correct 6 ms 340 KB Output is correct
31 Correct 6 ms 336 KB Output is correct
32 Correct 6 ms 336 KB Output is correct
33 Correct 6 ms 332 KB Output is correct
34 Correct 6 ms 336 KB Output is correct
35 Correct 6 ms 336 KB Output is correct
36 Correct 6 ms 336 KB Output is correct
37 Correct 6 ms 336 KB Output is correct
38 Correct 6 ms 344 KB Output is correct
39 Correct 7 ms 292 KB Output is correct
40 Correct 6 ms 336 KB Output is correct
41 Correct 6 ms 336 KB Output is correct
42 Correct 6 ms 336 KB Output is correct
43 Correct 6 ms 336 KB Output is correct
44 Correct 6 ms 336 KB Output is correct
45 Correct 6 ms 336 KB Output is correct
46 Correct 6 ms 336 KB Output is correct
47 Correct 5 ms 336 KB Output is correct
48 Correct 8 ms 336 KB Output is correct
49 Correct 6 ms 336 KB Output is correct
50 Correct 7 ms 336 KB Output is correct
51 Correct 6 ms 336 KB Output is correct
52 Correct 6 ms 336 KB Output is correct
53 Correct 7 ms 336 KB Output is correct
54 Correct 6 ms 336 KB Output is correct
55 Correct 6 ms 336 KB Output is correct
56 Correct 7 ms 340 KB Output is correct
57 Correct 7 ms 344 KB Output is correct
58 Correct 6 ms 336 KB Output is correct
59 Correct 6 ms 208 KB Output is correct
60 Correct 6 ms 336 KB Output is correct
61 Correct 7 ms 220 KB Output is correct
62 Correct 6 ms 336 KB Output is correct
63 Correct 5 ms 336 KB Output is correct
64 Correct 5 ms 336 KB Output is correct
65 Correct 6 ms 336 KB Output is correct
66 Correct 7 ms 336 KB Output is correct
67 Correct 6 ms 344 KB Output is correct
68 Correct 6 ms 336 KB Output is correct
69 Correct 6 ms 336 KB Output is correct
70 Correct 6 ms 336 KB Output is correct
71 Correct 6 ms 348 KB Output is correct
72 Correct 6 ms 340 KB Output is correct
73 Correct 6 ms 336 KB Output is correct
74 Correct 6 ms 336 KB Output is correct
75 Correct 6 ms 336 KB Output is correct
76 Correct 6 ms 336 KB Output is correct
77 Correct 6 ms 336 KB Output is correct
78 Correct 6 ms 336 KB Output is correct
79 Correct 9 ms 336 KB Output is correct
80 Correct 9 ms 336 KB Output is correct
81 Correct 9 ms 340 KB Output is correct
82 Correct 6 ms 336 KB Output is correct
83 Correct 5 ms 336 KB Output is correct
84 Correct 6 ms 336 KB Output is correct
85 Correct 6 ms 356 KB Output is correct
86 Correct 6 ms 336 KB Output is correct
87 Correct 6 ms 344 KB Output is correct
88 Correct 7 ms 336 KB Output is correct
89 Correct 6 ms 336 KB Output is correct
90 Correct 6 ms 336 KB Output is correct
91 Correct 6 ms 336 KB Output is correct
92 Correct 6 ms 336 KB Output is correct
93 Correct 6 ms 340 KB Output is correct
94 Correct 8 ms 336 KB Output is correct
95 Correct 6 ms 336 KB Output is correct
96 Correct 6 ms 336 KB Output is correct
97 Correct 7 ms 336 KB Output is correct
98 Correct 6 ms 340 KB Output is correct
99 Correct 6 ms 336 KB Output is correct
100 Correct 6 ms 336 KB Output is correct