Submission #1260903

#TimeUsernameProblemLanguageResultExecution timeMemory
1260903M_W_13Question (Grader is different from the original contest) (CEOI14_question_grader)C++20
100 / 100
764 ms39720 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define st first
#define nd second
#define pb push_back

vector<int> vec;

int przerzut(int a) {
  int c = 0;
  while ((int)vec.size() < 922) {
    while (__builtin_popcount(c) != 6) {
      c++;
    }
    vec.pb(c);
    c++;
  }
  return vec[a - 1];
}

int encode (int n, int x, int y) {
  x = przerzut(x);
  y = przerzut(y);
  int a = 1;
  int kt = 1;
  while (true) {
    if (((a & x) == a) && ((a & y) != a)) {
      return kt;
    }
    a *= 2;
    kt++;
  }
  return 0;
}
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define st first
#define nd second
#define pb push_back

vector<int> vec;

int przerzut(int a) {
  int c = 0;
  while ((int)vec.size() < 922) {
    while (__builtin_popcount(c) != 6) {
      c++;
    }
    vec.pb(c);
    c++;
  }
  return vec[a - 1];
}

int decode (int n, int q, int h) {
	q = przerzut(q);
	int a = 1;
	rep(i, h - 1) {
		a *= 2;
	}
	if ((a & q) == a) {
		return 1;
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...