QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116856#149. Peruyoungsystem#Compile Error//C++20788b2023-06-30 09:22:572024-05-31 18:32:09

Judging History

你现在查看的是测评时间为 2024-05-31 18:32:09 的历史记录

  • [2024-09-10 16:34:46]
  • 管理员手动重测本题所有提交记录
  • 测评结果:49
  • 用时:48ms
  • 内存:19236kb
  • [2024-05-31 18:32:09]
  • 评测
  • [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;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~