QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#408845#149. PeruieeCompile Error//C++17673b2024-05-11 09:07:072024-05-11 09:07:07

Judging History

This is a historical verdict posted at 2024-05-11 09:07:07.

  • [2024-09-10 16:45:52]
  • 管理员手动重测本题所有提交记录
  • Verdict: 18
  • Time: 1ms
  • Memory: 9956kb
  • [2024-05-11 09:07:07]
  • Judged
  • [2024-05-11 09:07:07]
  • Submitted

answer

#include "peru.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int N = 2.5e6 + 5, base = 23, mod = 1e9 + 7;
using ll = long long;
int n, k;
int a[N];
ll f[N];
int solve(int _n, int _k, int* _v){
    n = _n, k = _k;
    for (int i = 1; i <= n; i++) {
        a[i] = _v[i - 1];
    }
    for (int i = 1; i <= n; i++) {
        f[i] = 1e18;
        int mx = 0;
        for (int j = i - 1; j >= max(0, i - k); j--) {
            mx = max(mx, a[j + 1]);
            f[i] = min(f[i], f[j] + mx);
        }
    }
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        sum = (1ll * sum * base % mod + f[i]) % mod;
    }
    return sum;
}

Details

implementer.cpp: In function ‘int main()’:
implementer.cpp:34:13: error: ‘fout’ was not declared in this scope; did you mean ‘out’?
   34 |     fprintf(fout, "%d\n", sol);
      |             ^~~~
      |             out
implementer.cpp: In function ‘char nextch()’:
implementer.cpp:15:31: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     if (pos == BUF_SIZE) fread(buf, BUF_SIZE, 1, fin), pos = 0;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~