Submission #433954

# Submission time Handle Problem Language Result Execution time Memory
433954 2021-06-20T12:38:59 Z dxz05 Triple Jump (JOI19_jumps) C++14
0 / 100
64 ms 2668 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N = 5e5 + 3e2;

#define MP make_pair
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

pair<int, int> arr[N];

void solve(){
    int n;
    cin >> n;

    vector<int> perm(n);
    for (int i = 1; i <= n; i++){
        cin >> arr[i].first;
        arr[i].second = i;
    }

    sort(arr + 1, arr + n + 1);
    reverse(arr + 1, arr + n + 1);

    int q;
    cin >> q >> q >> q;

    for (int i = 1; i <= n; i++){
        for (int j = i + 1; j <= n; j++){
            for (int k = j + 1; k <= n; k++){
                int a = arr[i].second, b = arr[j].second, c = arr[k].second;

                if (a > c) swap(a, c); /// a < c
                if (b > c) swap(b, c); /// b < c
                if (a > b) swap(a, b); /// a < b;

                if (b - a <= c - b){
                    cout << arr[i].first + arr[j].first + arr[k].first << endl;
                    return;
                }

            }
        }
    }

}

int main(){
    ios_base::sync_with_stdio(false);
    //freopen("output.txt", "w", stdout);
    int tests = 1;
   // cin >> tests;

    while (tests--){
        solve();
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2616 KB Output is correct
2 Correct 64 ms 2624 KB Output is correct
3 Correct 30 ms 2636 KB Output is correct
4 Incorrect 57 ms 2668 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -