QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#623580#2225. Terrace HillC1942huangjiaxuWA 0ms3768kbC++14335b2024-10-09 13:15:592024-10-09 13:16:01

Judging History

This is the latest submission verdict.

  • [2024-10-09 13:16:01]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3768kb
  • [2024-10-09 13:15:59]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
typedef long long ll;
int n,a[N],st[N],tp;
ll ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		while(tp&&a[st[tp]]<a[i])--tp;
		if(tp&&a[st[tp]]==a[i])ans+=i-1-st[tp];
		st[++tp]=a[i];
	}
	printf("%lld\n",ans);
	return 0;
}

詳細信息

Test #1:

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

input:

103
198 105 115 81 255 74 236 41 205 186 171 242 251 227 70 124 194 84 248 27 232 231 141 118 90 46 99 51 159 201 154 102 50 13 183 49 88 163 90 37 93 5 23 88 233 94 212 171 178 205 198 155 180 84 17 14 130 116 65 33 61 220 135 112 233 62 161 65 225 252 103 62 1 126 151 234 220 107 150 143 56 92 42 ...

output:

7

result:

wrong answer 1st lines differ - expected: '19', found: '7'