Submission #1186197

#TimeUsernameProblemLanguageResultExecution timeMemory
1186197yehudalesterCoreputer (IOI23_coreputer)C++20
Compilation error
0 ms0 KiB
using namespace std;
using ll=int;
using vll=vector<ll>;
vll to_vector(ll x, ll n){
	vll vec;
	while(n--){
		vec.push_back(x%2);
		x/=2;
	}
	return vec;
}
vll vect(ll x){
	vll res;
	for(ll i=0;i<32;i++){
		if(x&(1<<i)){
			res.push_back(i);
		}
	}
	return res;
}
std::vector<int> malfunctioning_cores(int N) {
	vll vec((1<<N)-1);
	iota(vec.begin(),vec.end(),1);
	mt19937 rng(time(0));
	srand(time(0));
	while(vec.size()!=1){
		ll x=0;
		for(ll i=0;i<N;i++){
			if(rand()%2){
				x^=(1<<i);
			}
		}
		vll t;
		ll res=run_diagnostic(vect(x));
		for(ll y:vec){
			ll q=__builtin_popcount(y&x);
			ll w=__builtin_popcount(y&(~x));
			if(res==1){
				if(__builtin_popcount(y&x)>__builtin_popcount(y&(~x))){
					t.push_back(y);
				}
			}
			if(res==0){
				if(__builtin_popcount(y&x)==__builtin_popcount(y&(~x))){
					t.push_back(y);
				}
			}
			if(res==-1){
				if(__builtin_popcount(y&x)<__builtin_popcount(y&(~x))){
					t.push_back(y);
				}
			}
		}
		vec=t;
	}
	return to_vector(vec[0],N);
}

Compilation message (stderr)

coreputer.cpp:3:11: error: 'vector' does not name a type
    3 | using vll=vector<ll>;
      |           ^~~~~~
coreputer.cpp:4:1: error: 'vll' does not name a type; did you mean 'll'?
    4 | vll to_vector(ll x, ll n){
      | ^~~
      | ll
coreputer.cpp:12:1: error: 'vll' does not name a type; did you mean 'll'?
   12 | vll vect(ll x){
      | ^~~
      | ll
coreputer.cpp:21:6: error: 'vector' in namespace 'std' does not name a template type
   21 | std::vector<int> malfunctioning_cores(int N) {
      |      ^~~~~~
coreputer.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | using namespace std;