QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#301518#2731. Cartesian ConquestCamillusCompile Error//C++201.8kb2024-01-10 00:43:502024-01-10 00:43:51

Judging History

你现在查看的是最新测评结果

  • [2024-01-10 00:43:51]
  • 评测
  • [2024-01-10 00:43:50]
  • 提交

answer

#include "bits/stdc++.h"
using namespace std;

struct pair_hash {
    size_t operator()(const pair<int, int> &p) const {
        return p.first ^ p.second;
    }
};

int fff(int n, int m) {
    return mt19937_64((1ll * n) << 25 | m)() % 1e8;
}

unordered_map<int, int> saved_mx;

int mx_func(int n, int m) {
    if (n > m) {
        swap(n, m);
    }

    if (saved_mx.contains(fff(n, m))) {
        return saved_mx[fff(n, m)];
    }

    int cur = 0;

    if (n % 2 == 0 && m - n / 2 > 0) {
        cur = max(cur, mx_func(n, m - n / 2));
    }

    if (m % 2 == 0 && n - m / 2 > 0) {
        cur = max(cur, mx_func(n - m / 2, m));
    }

    if (m - 2 * n > 0) {
        cur = max(cur, mx_func(n, m - 2 * n));
    }

    if (n - 2 * m > 0) {
        cur = max(cur, mx_func(n - 2 * m, m));
    }

    return saved_mx[fff(n, m)] = cur + 1;
}

unordered_map<int, int>  saved_mn;

int mn_func(int n, int m) {
    if (n > m) {
        swap(n, m);
    }

    if (saved_mn.contains(fff(n, m))) {
        return saved_mn[fff(n, m)];
    }

    if (n == 2 * m || m == 2 * n) {
        return 1;
    }

    int cur = INT32_MAX;

    if (n % 2 == 0 && m - n / 2 > 0) {
        cur = min(cur, mn_func(n, m - n / 2));
    }

    if (m % 2 == 0 && n - m / 2 > 0) {
        cur = min(cur, mn_func(n - m / 2, m));
    }

    if (m - 2 * n > 0) {
        cur = min(cur, mn_func(n, m - 2 * n));
    }

    if (n - 2 * m > 0) {
        cur = min(cur, mn_func(n - 2 * m, m));
    }

    return saved_mn[fff(n, m)] = cur + 1;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    saved_mn.reserve(1e8);
    saved_mx.reserve(1e8);
    
    int n, m;
    cin >> n >> m;

    cout << mn_func(n, m) << ' ' << mx_func(n, m) << '\n';
    return 0;
}

詳細信息

answer.code: In function ‘int fff(int, int)’:
answer.code:11:46: error: invalid operands of types ‘std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type’ {aka ‘long unsigned int’} and ‘double’ to binary ‘operator%’
   11 |     return mt19937_64((1ll * n) << 25 | m)() % 1e8;
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~
      |                                           |    |
      |                                           |    double
      |                                           std::mersenne_twister_engine<long unsigned int, 64, 312, 156, 31, 13043109905998158313, 29, 6148914691236517205, 17, 8202884508482404352, 37, 18444473444759240704, 43, 6364136223846793005>::result_type {aka long unsigned int}