7462022-01-05 16:58:21seprbarInverziócpp11Time limit exceeded 12/50597ms51168 KiB
// Inverzio

#include <bits/stdc++.h>
using namespace std;

#define ls(N,T) for (int i = 0; i < N; i ++) cout << T[i] << ","

int main () {
	int N,M = 0,M_i,M_j;
	cin >> N;
	int T[N];
	for (int i = 0; i < N; i ++) {
		cin >> T[i];
	}
	for (int j = 0; j < N; j ++) {
		for (int i = 0; i < j-M; i ++) {
			if (T[i] > T[j]) {
				M = j-i;
				M_i = i+1;
				M_j = j+1;
			}
			if (M == N-1) break;
		}
		if (M == N-1) break;
	}
	if (M == 0) cout << "-1";
	else cout << M_i << " " << M_j << "\n";
}
SubtaskSumTestVerdictTimeMemory
base12/50
1Accepted0/03ms2192 KiB
2Time limit exceeded0/0578ms1788 KiB
3Accepted1/12ms2536 KiB
4Accepted2/21ms2544 KiB
5Accepted7/72ms2548 KiB
6Accepted2/2411ms3216 KiB
7Time limit exceeded0/2554ms7056 KiB
8Time limit exceeded0/2524ms10444 KiB
9Time limit exceeded0/2552ms13640 KiB
10Time limit exceeded0/2503ms17024 KiB
11Time limit exceeded0/2527ms20260 KiB
12Time limit exceeded0/2542ms23624 KiB
13Time limit exceeded0/2563ms26912 KiB
14Time limit exceeded0/2597ms30352 KiB
15Time limit exceeded0/2579ms32512 KiB
16Time limit exceeded0/2596ms30340 KiB
17Time limit exceeded0/2552ms33540 KiB
18Time limit exceeded0/2554ms36872 KiB
19Time limit exceeded0/3546ms40304 KiB
20Time limit exceeded0/3555ms43628 KiB
21Time limit exceeded0/2532ms46944 KiB
22Time limit exceeded0/2555ms50080 KiB
23Time limit exceeded0/2591ms47908 KiB
24Time limit exceeded0/2569ms51168 KiB