QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#569773#9313. Make MaxjxxiaoyuWA 0ms5196kbC++14545b2024-09-17 10:32:202024-09-17 10:32:21

Judging History

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

  • [2024-09-18 15:56:24]
  • hack成功,自动添加数据
  • (/hack/836)
  • [2024-09-17 10:32:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5196kb
  • [2024-09-17 10:32:20]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
//int x[9]={0,1,0,1,-1,0,-1,1,-1}; 
//int y[9]={0,0,1,1,0,-1,-1,-1,1};
void solve(){
	int n;
	cin>>n;
	int a[200005]={0};
	for(int i=1;i<=n;i++){
		cin>>a[i];
	} 
	int ans=0;
	for(int i=1;i<=n;i++){
		int l=0,r=0;
		while(a[i-l-1]<a[i]&&a[i-l-1]>0)l++;
		while(a[i+r+1]<a[i]&&a[i+r+1]>0)r++;
		if(a[i+r+1]==a[i]){
			continue;
		}
		ans+=(l+r);
	}
	cout<<ans<<endl;
}
signed main() {
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5196kb

input:

4
2
1 2
2
2 2
7
1 1 1 2 2 2 2
3
1 2 3

output:

1
0
0
3

result:

wrong answer 3rd numbers differ - expected: '3', found: '0'