제출 #433954

#제출 시각아이디문제언어결과실행 시간메모리
433954dxz05Triple Jump (JOI19_jumps)C++14
0 / 100
64 ms2668 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...