QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#487354 | #8634. 求和 | qycc | Compile Error | / | / | C++14 | 325b | 2024-07-22 20:25:06 | 2024-07-22 20:25:06 |
Judging History
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;
}
Details
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