Submission #91397

#TimeUsernameProblemLanguageResultExecution timeMemory
91397emil_physmathSimple game (IZhO17_game)C++14
22 / 100
1066 ms1644 KiB
#include <iostream>
#include <stdio.h>
using namespace std;

int h[100005];

int main()
{
	int n, m;
	cin>>n>>m;
	for (int i=0; i<n; i++)
		cin>>h[i];
	while (m--)
	{
		int type;
		cin>>type;
		if (type==1)
		{
			int pos, val;
			cin>>pos>>val;
			h[pos-1]=val;
		}
		else
		{
			int H, ans=0;
			cin>>H;
			char curState='0';
			for (int i=0; i<n; i++)
				if (h[i]<H)
				{
					if (curState=='>')
						ans++;
					curState='<';
				}
				else
				{
					if (curState=='<')
						ans++;
					curState='>';
				}
			cout<<ans<<'\n';
		}
	}

	char I;
	cin >> I;
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...