QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#579145 | #9313. Make Max | dxr | Compile Error | / | / | C++14 | 638b | 2024-09-21 09:39:17 | 2024-09-21 09:39:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=3e5+5;
void solve()
{
int n; cin>>n;
int a[N],l[N],r[N];
stack<int> s;
for(int i=1;i<=n;i++) cin>>a[i];
for(iny i=n;i>=1;i--)
{
while(!s.empty()&&a[s.top()]<a[i]) s.pop();
r[i]=s.empty()? n:s.top();
s.push(i);
}
while(!s.empty()) s.pop();
for(int i=1;i<=n;i++)
{
while(!s.empty()&&a[s.top()]<a[i]) s.pop();
l[i]=s.empty()?1:s.top();
s.push(i);
}
ll ans=0;
for(int i=1;i<=n;i++) ans+=r[i]-l[i]-2;
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int t; cin>>t;
while(t--)
{
solve();
}
return 0;
}
詳細信息
answer.code: In function ‘void solve()’: answer.code:10:13: error: ‘iny’ was not declared in this scope; did you mean ‘int’? 10 | for(iny i=n;i>=1;i--) | ^~~ | int answer.code:10:21: error: ‘i’ was not declared in this scope 10 | for(iny i=n;i>=1;i--) | ^ answer.code:23:9: error: ‘ll’ was not declared in this scope; did you mean ‘l’? 23 | ll ans=0; | ^~ | l answer.code:24:31: error: ‘ans’ was not declared in this scope; did you mean ‘abs’? 24 | for(int i=1;i<=n;i++) ans+=r[i]-l[i]-2; | ^~~ | abs