QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#116856 | #149. Peru | youngsystem# | Compile Error | / | / | C++20 | 788b | 2023-06-30 09:22:57 | 2024-05-31 18:32:09 |
Judging History
你现在查看的是测评时间为 2024-05-31 18:32:09 的历史记录
- [2024-05-31 18:32:09]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-06-30 09:22:57]
- 提交
answer
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
int a[2500005];
int que[2500005],ql,qr;
long long dp[2500005];
set<long long>se;
int solve(int n,int k,int* S)
{
for(int i=1;i<=n;i++)a[i]=S[i-1];
ql=qr=1;
que[1]=0;
a[0]=2000000000;
for(int i=1;i<=n;i++)
{
while(qr>=ql&&que[ql]<i-k)
{
if(ql<qr)se.erase(dp[que[ql]]+a[que[ql+1]]);
ql++;
}
while(qr>=ql&&a[que[qr]]<=a[i])
{
if(ql<qr)se.erase(dp[que[qr-1]]+a[que[qr]]);
qr--;
}
dp[i]=1000000000000000000LL;
if(ql<=qr)se.insert(dp[que[qr]]+a[i]);
que[++qr]=i;
if(!se.empty())dp[i]=(*se.begin());
dp[i]=min(dp[i],dp[i-k]+a[que[ql]]);
//printf("%d %lld\n",i,dp[i]);
}
int ans=0;
for(int i=1;i<=n;i++)ans=(23LL*ans+dp[i]%mod)%mod;
return ans;
}
詳細信息
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; | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~