답안 #1002622

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1002622 2024-06-19T17:03:54 Z c2zi6 비교 (balkan11_cmp) C++14
46 / 100
899 ms 96080 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 his;
    if (bit_get(pref(b, d-1)*4 + 0 + delta[d])) his = 0;
    if (bit_get(pref(b, d-1)*4 + 1 + delta[d])) his = 1;
    if (bit_get(pref(b, d-1)*4 + 2 + delta[d])) his = 2;
    if (bit_get(pref(b, d-1)*4 + 3 + delta[d])) his = 3;
    int my = pref(b, d)%4;
    if (my > his) return +1;
    return -1;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 899 ms 96080 KB Output is partially correct - maxAccess = 16, score = 46