QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#579145#9313. Make MaxdxrCompile Error//C++14638b2024-09-21 09:39:172024-09-21 09:39:17

Judging History

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

  • [2024-09-21 09:39:17]
  • 评测
  • [2024-09-21 09:39:17]
  • 提交

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