QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#153531#2587. 荣誉称号eikkiCompile Error//C++202.4kb2023-08-30 10:15:092023-08-30 10:15:09

Judging History

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

  • [2023-08-30 10:15:09]
  • 评测
  • [2023-08-30 10:15:09]
  • 提交

answer

#include <iostream>
#include <vector>
#include <climits>

long long c[(1 << 12) + 5][205];
bool mem[(1 << 12) + 5][205];
long long cache[(1 << 12) + 5][205];
bool mem2[(1 << 12) + 5][205];
long long cache2[(1 << 12) + 5][205];

unsigned int SA, SB, SC; long long p, A, B, n, k, m;

unsigned int rng61(){
    SA ^= SA << 16;
    SA ^= SA >> 5;
    SA ^= SA << 1;
    unsigned int t = SA;
    SA = SB;
    SB = SC;
    SC ^= t ^ SA;
    return SC;
}

void gen(){
    std::cin >> n >> k >> m >> p >> SA >> SB >> SC >> A >> B;
    for(int i = 1; i <= p; i++) {
        int ai, bi;
        std::cin >> ai >> bi;
        int j = i;
        while (j >= (1 << k + 1)) j >>= k + 1;
        c[j][ai % m] += bi;
    }
    for(int i = p + 1; i <= n; i++){
        int j = i;
        while (j > (1 << k + 1)) j >>= k + 1;
        int ai = rng61() % A + 1;
        int bi = rng61() % B + 1;
        c[j][ai % m] += bi;
    }
}

long long cost(int i, int q) {
    if (mem2[i][q]) return cache2[i][q];
    long long sum = 0;
    for (int e = 0; e < m; e++) {
        sum += 1LL * ((q - e + m) % m) * c[i][e];
    }
    mem2[i][q] = true;
    return cache2[i][q] = sum;
}

long long dp(int node, int sum) {
    if (mem[node][sum]) return cache[node][sum];
    if (node < (1 << k)) {
        long long best = LLONG_MAX/32;
        for (int i = 0; i < m; i++) {
            int new_sum = (sum - i + m) % m;
            best = std::min(best, cost(node, i) + dp(2*node, new_sum) + dp(2*node+1, new_sum));
        }
        mem[node][sum] = true;
        return cache[node][sum] = best;
    }
    mem[node][sum] = true;
    return cache[node][sum] = cost(node, sum);
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    int T;
    std::cin >> T;
    while (T--) {
        std::memset(c, 0, sizeof(c));
        std::memset(mem, 0, sizeof(mem));
        std::memset(cache, 0, sizeof(cache));
        std::memset(mem2, 0, sizeof(mem2));
        std::memset(cache2, 0, sizeof(cache2));
        // for (int j = 0; j < (1 << 12) + 5; j++) {
        //     for (int k1 = 0; k1 < 205; k1++) {
        //         c[j][k1] = 0;
        //         mem[j][k1] = false;
        //         cache[j][k1] = 0;
        //         mem2[j][k1] = false;
        //         cache2[j][k1] = 0;
        //     }
        // }
        gen();
        std::cout << dp(1, 0) << std::endl;
    }
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:73:14: error: ‘memset’ is not a member of ‘std’; did you mean ‘wmemset’?
   73 |         std::memset(c, 0, sizeof(c));
      |              ^~~~~~
      |              wmemset
answer.code:74:14: error: ‘memset’ is not a member of ‘std’; did you mean ‘wmemset’?
   74 |         std::memset(mem, 0, sizeof(mem));
      |              ^~~~~~
      |              wmemset
answer.code:75:14: error: ‘memset’ is not a member of ‘std’; did you mean ‘wmemset’?
   75 |         std::memset(cache, 0, sizeof(cache));
      |              ^~~~~~
      |              wmemset
answer.code:76:14: error: ‘memset’ is not a member of ‘std’; did you mean ‘wmemset’?
   76 |         std::memset(mem2, 0, sizeof(mem2));
      |              ^~~~~~
      |              wmemset
answer.code:77:14: error: ‘memset’ is not a member of ‘std’; did you mean ‘wmemset’?
   77 |         std::memset(cache2, 0, sizeof(cache2));
      |              ^~~~~~
      |              wmemset