Submission #704431

# Submission time Handle Problem Language Result Execution time Memory
704431 2023-03-02T06:10:59 Z ld_minh4354 Sandcastle 2 (JOI22_ho_t5) C++17
9 / 100
9 ms 1108 KB
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define pb push_back
#define debug(x) cout<<#x<<": "<<x<<"\n"



signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//	freopen("input.000","r",stdin);
//	freopen("output.000","w",stdout);
//	srand((unsigned)time(NULL));
//	rand()
	
	int n,i,a[50005],c,ans;
	
	cin>>n>>n;
	for (i=1;i<n+1;i++) cin>>a[i];
	
	ans=0;
	c=1;
	for (i=2;i<n+1;i++)
	if (a[i-1]>a[i]) c++;
	else
	{
		ans += (c*(c+1))/2;
		c=1;
	}
	ans += (c*(c+1))/2;
	
	c=1;
	for (i=n-1;i>0;i--)
	if (a[i+1]>a[i]) c++;
	else
	{
		ans += (c*(c+1))/2;
		c=1;
	}
	ans += (c*(c+1))/2;
	
	ans -= n;
	cout<<ans;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 704 KB Output is correct
2 Correct 9 ms 972 KB Output is correct
3 Correct 8 ms 972 KB Output is correct
4 Correct 5 ms 980 KB Output is correct
5 Correct 5 ms 980 KB Output is correct
6 Correct 7 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 596 KB Output isn't correct
2 Halted 0 ms 0 KB -