Skip to content

manojkumar1906/r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

#include #include #include using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; bool v = true; int a[n];

	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}

	if (a[0] == 1 && n % 2 != 0)
	{
		for (int i = 0; i < n; i++)
		{
			if (i < n / 2)
			{
				if (a[i] - a[i + 1] != -1)
				{
					v = false;
					break;
				}
			}

			else if (i >= n / 2 && i < n - 1)
			{
				if (a[i] - a[i + 1] != 1)
				{
					v = false;
					break;
				}
			}
		}

		if (v)
			cout << "yes" << endl;
		else
			cout << "no" << endl;
	}
	else
	{
		cout << "no" << endl;
	}
}
return 0;
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors