71642024-01-01 10:07:57MagyarKendeSZLGLegmesszebbi rossz sorrendű (35 pont)cpp17Time limit exceeded 3/35300ms6072 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define has(s, e) s.count(e)

using namespace std;
using ll = long long;
using point = array<int, 2>;

int main() {
    speed;

    int N;
    cin >> N;
    vector<int> v(N), s, u;
    cinv(v);
    s = v;
    sort(all(s));

    for (int i = 0; i < N; i++) {
        if (s[i] != v[i]) u.push_back(v[i]);
    }

    N = u.size();

    for (int w = N; w > 0; w--) {
        for (int i = 0, j = w - 1; j < N; i++, j++) {
            if (u[i] > u[j]) {
                cout << i + 1 << ' ' << j + 1;
                exit(0);
            }
        }
    }

    cout << -1;
}
SubtaskSumTestVerdictTimeMemory
base3/35
1Accepted0/03ms2008 KiB
2Time limit exceeded0/0300ms2964 KiB
3Accepted1/13ms2372 KiB
4Accepted1/13ms2572 KiB
5Wrong answer0/13ms2656 KiB
6Wrong answer0/13ms2880 KiB
7Wrong answer0/13ms3016 KiB
8Wrong answer0/13ms3352 KiB
9Wrong answer0/14ms3328 KiB
10Accepted1/17ms3668 KiB
11Wrong answer0/110ms3620 KiB
12Time limit exceeded0/2259ms3600 KiB
13Time limit exceeded0/2266ms3720 KiB
14Time limit exceeded0/2238ms3728 KiB
15Time limit exceeded0/2257ms3708 KiB
16Time limit exceeded0/2257ms4304 KiB
17Time limit exceeded0/2266ms4684 KiB
18Time limit exceeded0/2266ms4732 KiB
19Time limit exceeded0/2259ms4888 KiB
20Time limit exceeded0/2266ms4876 KiB
21Time limit exceeded0/2254ms4896 KiB
22Time limit exceeded0/2282ms5080 KiB
23Wrong answer0/214ms6072 KiB
24Wrong answer0/214ms5984 KiB