提交记录 21688


用户 题目 状态 得分 用时 内存 语言 代码长度
Xiaohuba 1011a. 测测你的五维数点2 Accepted 100 4.167 s 55568 KB C++ 3.03 KB
提交时间 评测时间
2024-04-30 22:04:27 2024-04-30 22:04:33
#include <bits/stdc++.h>

using namespace std;

// #define LOCK_GETCHAR
// #define USE_INT_128

#if __cplusplus < 201400
#warning "Please use c++14 or higher."
#define CONSTEXPR_FUNC
#define ENABLE_IF_INT
#else
#define CONSTEXPR_FUNC constexpr
#define ENABLE_IF_INT , enable_if_t<_is_integer<T>, int> = 0
template <class T> constexpr bool _is_integer = numeric_limits<T>::is_integer;
template <> constexpr bool _is_integer<bool> = false;
template <> constexpr bool _is_integer<char> = false;
#ifdef USE_INT_128
template <> constexpr bool _is_integer<__int128> = true;
template <> constexpr bool _is_integer<__uint128_t> = true;
#endif
template <class T ENABLE_IF_INT>
constexpr T INF = numeric_limits<T>::max() >> 1;
#endif

#if !defined(_WIN32) && !defined(LOCK_GETCHAR)
#define getchar getchar_unlocked
#endif

#define il inline
#define mkp make_pair
#define fi first
#define se second
#define For(i, j, k) for (decltype(j - k) i = (j); i <= (k); ++i)     // NOLINT
#define ForDown(i, j, k) for (decltype(j - k) i = (j); i >= (k); --i) // NOLINT
#define pb push_back
#define eb emplace_back
#ifndef ONLINE_JUDGE
#define FileIO(filename)                                                       \
  freopen(filename ".in", "r", stdin);                                         \
  freopen(filename ".out", "w", stdout)
#else
#define FileIO(filename) void(0)
#endif

using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
using db = double;
using ldb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#ifdef USE_INT_128
using lll = __int128_t;
using ulll = __uint128_t;
#endif

// clang-format off
template<typename T> constexpr il T sq(const T & x){ return x * x; }
template<typename T> CONSTEXPR_FUNC il void cmin(T & x, const T &y){ x = min(x, y); }
template<typename T> CONSTEXPR_FUNC il void cmax(T & x, const T &y){ x = max(x, y);}
template<typename T> CONSTEXPR_FUNC il T qpow(T x, ull y, T mod){T ans = 1; x %= mod; while (y) { if(y & 1)(ans *= x) %= mod;(x *= x) %= mod; y >>= 1;} return ans;}
template<typename T> CONSTEXPR_FUNC il T qpow(T x, ull y){T ans = 1; while (y) {if(y & 1) ans *= x;x *= x;y >>= 1;} return ans;}
template<typename T ENABLE_IF_INT> il void read(T &x){ x = 0; int f = 1; int c = getchar(); while(!isdigit(c)) {if (c == '-') f = -1;c = getchar();} while(isdigit(c)) {x = x * 10 + c - '0';c = getchar();} x *= f;}
template<typename T, typename ... Args> il void read(T &x, Args &... y){ read(x); read(y...); }
// clang-format on

// File head end

namespace {
constexpr ll MAXN = 1e5;
bitset<MAXN> a[5][550];
vector<int> id[5][MAXN];
bitset<MAXN> get_set(int k, int v) {
  if (v < 0)
    return {};
  auto cur = a[k][v / 548];
  For(i, v - v % 548, v) for (int j : id[k][i]) cur[j] = 1;
  return cur;
}
} // namespace

void count_5d(int n, const unsigned *x[5], unsigned *out) {
  For(k, 0, 4) For(i, 0, n - 1) {
    id[k][x[k][i]].eb(i);
    For(j, x[k][i] / 548 + 1, 548) a[k][j][i] = 1;
  }
  For(i, 0, n - 1) {
    bitset<MAXN> cur;
    cur.set();
    For(k, 0, 4) cur &= get_set(k, x[k][i] - 1);
    out[i] = cur.count();
  }
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #14.167 s54 MB + 272 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:34:51 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠