Submission #92644

# Submission time Handle Problem Language Result Execution time Memory
92644 2019-01-04T09:19:08 Z MRtoma Money (IZhO17_money) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
#define f first
#define s second
#define inf 999999999999
#define N  1000009
#define M  (L+R)/2
#define ll long long
#define pb push_back
using namespace std;

ll n,a[N],i,j,ans,sum,b[N],fix[N];

int main()
{

	ios::sync_with_stdio(0);
	
	cin>>n;
	
	for(i=1;i<=n;i++)
	{
		cin>>a[i];
		b[i]=a[i];
	}
	
	sort(b+1,b+1+n);
	
	for(i=1;i<n;i++)
	{
		fix[b[i]]=b[i+1];
	}
	
	ans=n-1;
	
	for(i=1;i<n;i++)
	{
		if(fix[a[i]]==a[i+1])ans--;
	}
	
	cout<<ans<<endl;

return 0;
}




# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -