QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#166615 | #149. Peru | kkio | Compile Error | / | / | C++14 | 953b | 2023-09-06 15:34:21 | 2024-09-10 16:44:10 |
Judging History
你现在查看的是最新测评结果
- [2024-09-10 16:44:10]
- 管理员手动重测本题所有提交记录
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-06 15:34:21]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-09-06 15:34:21]
- 提交
answer
#include <bits/stdc++.h>
#inlude "peru.h"
using namespace std;
const int maxn=1e7+10,mod=1e9+7;
unsigned int seed;
unsigned int Read(){
seed ^= seed << 13;
seed ^= seed >> 7;
seed ^= seed << 11;
return seed % 2000000000 + 1;
}
typedef long long ll;
int n,k,type;
int stk[maxn],pre[maxn],top,pw[maxn];
ll f[maxn];
void solve(int n,int k,int *a)
{
ios::sync_with_stdio(0),cin.tie(0);
if(type==1)
{for(int i=1;i<=n;i++)a[i]=Read();}
else
{for(int i=1;i<=n;i++)cin>>a[i];}
pre[0]=-1;
for(int i=1;i<=n;i++)
{
while(top&&a[stk[top]]<=a[i])top--;
if(!top)pre[i]=0;
else pre[i]=stk[top];
stk[++top]=i;
}
for(int i=1;i<=n;i++)
{
f[i]=f[i-1]+a[i];
int x=pre[i],nmx=a[i];while(i-x<=k&&x>0){f[i]=min(f[i],f[x]+nmx);nmx=a[x];x=pre[x];}
f[i]=min(f[i],f[max(i-k,0)]+nmx);
}
int ans=0;
for(int i=1;i<=n;i++)ans=(1ll*ans*23%mod+(f[i]%mod))%mod;
cout<<ans<<endl;
}
/*
7 3 0 1
6 9 2 7 2 5 6
*/
详细
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; | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ answer.code:2:2: error: invalid preprocessing directive #inlude; did you mean #include? 2 | #inlude "peru.h" | ^~~~~~ | include