QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#116808#149. PeruHe_Ren#Compile Error//C++17689b2023-06-30 08:37:102024-05-31 18:29:44

Judging History

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

  • [2024-09-10 16:33:37]
  • 管理员手动重测本题所有提交记录
  • 测评结果:18
  • 用时:1ms
  • 内存:8048kb
  • [2024-05-31 18:29:44]
  • 评测
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 08:37:10]
  • 提交

answer

#include<bits/stdc++.h>
#include"peru.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 2.5e5 + 5;
const int mod = 1e9 + 7;
const ll linf = 0x3f3f3f3f3f3f3f3f;

int a[MAXN];

int solve(int n, int d, int *_a)
{
	for(int i=1; i<=n; ++i)
		a[i] = _a[i-1];
	
	static ll f[MAXN];
	fill(f+1, f+n+1, linf);
	f[0] = 0;
	
	for(int i=1; i<=n; ++i)
	{
		int cur = 0;
		for(int j=i; j>=1 && j>=i-d+1; --j)
		{
			cur = max(cur, a[j]);
			f[i] = min(f[i], f[j-1] + cur);
		}
	}
	
	int ans = 0, curpw = 1;
	for(int i=n; i>=1; --i)
	{
		ans = (ans + (ll)f[i] %mod * curpw) %mod;
		curpw = (ll)curpw * 23 %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;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~