QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#487354#8634. 求和qyccCompile Error//C++14325b2024-07-22 20:25:062024-07-22 20:25:06

Judging History

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

  • [2024-07-22 20:25:06]
  • 评测
  • [2024-07-22 20:25:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1e6+7;
int n;
int p[N],pos[N];
int main()
{
	cin>>n;
	long long res=0;
	for(int i=1;i<=n;i++)read(p[i]),pos[p[i]]=i; 
	int l=1e9,r=0;
	for(int i=0;i<n;i++)
	{
		l=min(l,pos[i]);
		r=max(r,pos[i]);
		res+=1ll*l*(n-r+1);
	}
	cout<<res;
	return 0;
} 

詳細信息

answer.code: In function ‘int main()’:
answer.code:10:30: error: ‘read’ was not declared in this scope; did you mean ‘fread’?
   10 |         for(int i=1;i<=n;i++)read(p[i]),pos[p[i]]=i;
      |                              ^~~~
      |                              fread