QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#166616#149. PerukkioCompile Error//C++14954b2023-09-06 15:34:562024-09-10 16:44:10

Judging History

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

  • [2024-09-10 16:44:10]
  • 管理员手动重测本题所有提交记录
  • [2023-09-06 15:34:56]
  • 评测
  • [2023-09-06 15:34:56]
  • 提交

answer

#include <bits/stdc++.h>
#include "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:16:6: error: ambiguating new declaration of ‘void solve(int, int, int*)’
   16 | void solve(int n,int k,int *a)
      |      ^~~~~
In file included from answer.code:2:
peru.h:1:5: note: old declaration ‘int solve(int, int, int*)’
    1 | int solve(int n, int k, int* v);
      |     ^~~~~