QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#592773#9313. Make MaxNene1Compile Error//C++14795b2024-09-27 03:35:212024-09-27 03:35:23

Judging History

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

  • [2024-09-27 03:35:23]
  • 评测
  • [2024-09-27 03:35:21]
  • 提交

answer

#include<bits/stdc++.h>
#pragma optimize("O2")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+10;
ll t;
ll a[N];
void solve()
{
	ll n;
	cin>>n;
	for(ll i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	
	vector<ll> L{0};
	a[0]=a[n+1]=2e9+10;
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		while(L.size()&&a[L.back()]<a[i])
		{
			L.pop_back();
		}
		if(a[i]!=L.back())ans+=i-L.back()-1;
		L.push_back(i);
	}
	
	vector<ll>R{n+1};
	for(ll i=n;i>=1;i--)
	{
		while(R.size()&&a[i]>a[R.back()])
		{
			R.pop_back();
		}
		(ifa[i]!=R.back())ans+=R.back()-i-1;
		R.push_back(i);
	}
	cout<<ans<<'\n';
}

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin>>t;
	while(t--)
	{
		solve();
	}
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:38:18: error: ‘ifa’ was not declared in this scope
   38 |                 (ifa[i]!=R.back())ans+=R.back()-i-1;
      |                  ^~~