# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1002634 |
2024-06-19T17:15:49 Z |
c2zi6 |
cmp (balkan11_cmp) |
C++14 |
|
1014 ms |
96172 KB |
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "cmp.h"
VI delta = {5457, 5441, 5377, 5121, 4097, 1};
int pref(int x, int i) {
return (x >> (5-i)*2);
}
void remember(int n) {
rep(i, 6) {
bit_set(pref(n, i) + delta[i]);
}
}
int compare(int b) {
int d;
auto can = [&](int m) {
return bit_get(pref(b, m) + delta[m]);
};
/*gtnel en amenaarajin tiv@ [0, 6] mijakayqum, or can(i) = 0*/
/*0 1 2 3 4 5*/
if (can(3)) {
if (can(4)) {
if (can(5)) d = 6;
else d = 5;
} else d = 4;
} else {
if (can(1)) {
if (can(2)) d = 3;
else d = 2;
} else {
if (can(0)) d = 1;
else d = 0;
}
}
/*rep(i, 6) {*/
/* if (!bit_get(pref(b, i) + delta[i])) {*/
/* d = i;*/
/* break;*/
/* }*/
/*}*/
if (d == 6) return 0;
int my = pref(b, d)%4;
if (my == 3) return +1;
if (my == 0) return -1;
if (my == 2) {
if (bit_get(pref(b, d-1)*4 + 3 + delta[d])) return -1;
return +1;
}
if (my == 1) {
if (bit_get(pref(b, d-1)*4 + 0 + delta[d])) return +1;
return -1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1014 ms |
96172 KB |
Output is correct - maxAccess = 10, score = 100 |