Submission #1002624

# Submission time Handle Problem Language Result Execution time Memory
1002624 2024-06-19T17:07:57 Z c2zi6 cmp (balkan11_cmp) C++14
73 / 100
765 ms 100524 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 = 6;
    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 Partially correct 765 ms 100524 KB Output is partially correct - maxAccess = 13, score = 73