QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#152925#149. PeruAbdelmagedNour#Compile Error//C++20973b2023-08-29 00:35:242024-07-04 01:52:12

Judging History

你现在查看的是测评时间为 2024-07-04 01:52:12 的历史记录

  • [2024-09-10 16:43:59]
  • 管理员手动重测本题所有提交记录
  • 测评结果:49
  • 用时:196ms
  • 内存:33852kb
  • [2024-07-04 01:52:12]
  • 评测
  • [2023-08-29 00:35:24]
  • 提交

answer

#include <bits/stdc++.h>
//#pragma GCC optimize("Ofast")
using namespace std;
//#include "grader.cpp"
#include "peru.h"
typedef long long ll;
const int N=2500005,mod=(1e9)+7;
ll dp[N];
bitset<N>in_queue;
int solve(int n, int k, int* v){
    deque<int>dq;
    v--;
    priority_queue<pair<ll,pair<int,int>>>pq;
    for(int i=1;i<=n;i++){
        while(!dq.empty()&&dq.front()<i-k)in_queue[dq.front()]=0,dq.pop_front();
        while(!dq.empty()&&v[dq.back()]<=v[i])in_queue[dq.back()]=0,dq.pop_back();
        if(!dq.empty())pq.push({-dp[dq.back()]-v[i],{dq.back(),i}});
        dq.push_back(i);
        in_queue[i]=1;
        while(!pq.empty()&&(!in_queue[pq.top().second.first]||!in_queue[pq.top().second.second]))pq.pop();
        dp[i]=LLONG_MAX;
        if(!pq.empty())dp[i]=-pq.top().first;
        dp[i]=min(dp[i],dp[max(i-k,0)]+v[dq.front()]);
    }
    long long res=0;
    for(int i=1;i<=n;i++)res=(res*23+dp[i])%mod;
    return res;
}

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;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~