50702023-04-14 11:42:10czitaLegmesszebbi rossz sorrendű (35 pont)cpp17Wrong answer 3/3557ms7284 KiB
#include <bits/stdc++.h>
using namespace std;
vector<int> E,R,K;
int logker(int a)
{
	int e = 0, v = R.size() - 1,fele;
	bool talalt = false;
	while (!talalt&&e<=v)
	{
		fele = (e + v) / 2;
		if (a==R[fele])
		{
			return fele;
		}
		else if (a > R[fele])
		{
			e = fele + 1;
		}
		else
		{
			v = fele - 1;
		}
	}
	return -1;
}
/*
10
7 2 4 17 6 5 10 10 18 19
*/
int main()
{
	int n;
	cin >> n;
	
	int a;
	for (size_t i = 0; i < n; i++)
	{
		cin >> a;
		E.push_back(a);
		R.push_back(a);
	}
	sort(R.begin(),R.end());
	for (size_t i = 0; i < n; i++)
	{
		K.push_back(i - logker(E[i]));
	}
	int minn = 0,maxx=0;
	for (size_t i = 0; i < n; i++)
	{
		if (K[i]<K[minn])
		{
			minn = i;
		}
		if (K[i] > K[maxx])
		{
			maxx = i;
		}
	}
	cout << abs(minn)+1 << " " << abs(maxx)+1 << endl;
}

SubtaskSumTestVerdictTimeMemory
base3/35
1Accepted0/03ms1872 KiB
2Wrong answer0/057ms5100 KiB
3Wrong answer0/13ms2336 KiB
4Wrong answer0/13ms2552 KiB
5Wrong answer0/13ms2796 KiB
6Accepted1/12ms2836 KiB
7Wrong answer0/13ms3044 KiB
8Wrong answer0/13ms3176 KiB
9Wrong answer0/13ms3160 KiB
10Wrong answer0/14ms3448 KiB
11Wrong answer0/14ms3408 KiB
12Wrong answer0/221ms4580 KiB
13Wrong answer0/224ms4580 KiB
14Wrong answer0/226ms4836 KiB
15Wrong answer0/217ms4536 KiB
16Wrong answer0/227ms5112 KiB
17Wrong answer0/241ms6208 KiB
18Wrong answer0/246ms6548 KiB
19Wrong answer0/252ms6888 KiB
20Wrong answer0/252ms6892 KiB
21Wrong answer0/257ms6808 KiB
22Wrong answer0/257ms6816 KiB
23Accepted2/243ms7192 KiB
24Wrong answer0/243ms7284 KiB