CP-Algorithms Library

This documentation is automatically generated by competitive-verifier/competitive-verifier

View the Project on GitHub cp-algorithms/cp-algorithms-aux

:heavy_check_mark: Nim Product (verify/number_theory/nim_product.test.cpp)

Depends on

Code

// @brief Nim Product
#define PROBLEM "https://judge.yosupo.jp/problem/nim_product_64"
#pragma GCC optimize("O3,unroll-loops")
#include <bits/allocator.h>
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt,pclmul")
#define CP_ALGO_CHECKPOINT
#include <iostream>
#include "blazingio/blazingio.min.hpp"
#include <immintrin.h>
#include "cp-algo/util/big_alloc.hpp"
#include "cp-algo/util/checkpoint.hpp"
#include "cp-algo/number_theory/nimber.hpp"
#include <bits/stdc++.h>

using namespace std;
using namespace cp_algo::math::nimber;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    cp_algo::big_vector<uint64_t> A(t), B(t);
    for (int i = 0; i < t; i++) {
        cin >> A[i] >> B[i];
    }
    cp_algo::checkpoint("read");
    for (int i = 0; i < t; i++) {
        A[i] = nim_to_poly(A[i]);
        B[i] = nim_to_poly(B[i]);
    }
    cp_algo::checkpoint("to_poly");
    for (int i = 0; i < t; i++) {
        A[i] = reduce_mod(clmul(A[i], B[i]));
    }
    cp_algo::checkpoint("clmul+reduce");
    for (int i = 0; i < t; i++) {
        A[i] = poly_to_nim(A[i]);
    }
    cp_algo::checkpoint("to_nim");
    for (int i = 0; i < t; i++) {
        cout << A[i] << "\n";
    }
    cp_algo::checkpoint("print");
    cp_algo::checkpoint<1>();
}
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj_resolve/resolver.py", line 181, in resolve
    bundled_code = language.bundle(path, basedir=basedir)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus.py", line 252, in bundle
    bundler.update(path)
  File "/home/runner/.local/lib/python3.12/site-packages/competitive_verifier/oj/verify/languages/cplusplus_bundle.py", line 327, in update
    assert len(lines) == len(uncommented_lines)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Test cases

Env Name Status Elapsed Memory
g++ example_00 :heavy_check_mark: AC 6 ms 6 MB
g++ large_00 :heavy_check_mark: AC 83 ms 81 MB
g++ large_few_00 :heavy_check_mark: AC 14 ms 12 MB
g++ power_of_two_00 :heavy_check_mark: AC 6 ms 6 MB
g++ random_00 :heavy_check_mark: AC 82 ms 80 MB
g++ random_01 :heavy_check_mark: AC 84 ms 80 MB
g++ random_few_00 :heavy_check_mark: AC 14 ms 11 MB
g++ random_few_01 :heavy_check_mark: AC 14 ms 11 MB
g++ small_00 :heavy_check_mark: AC 41 ms 33 MB
g++ small_few_00 :heavy_check_mark: AC 10 ms 8 MB
Back to top page