제출 #433943

#제출 시각아이디문제언어결과실행 시간메모리
433943dxz053단 점프 (JOI19_jumps)C++14
0 / 100
54 ms2664 KiB
#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> a[N]; void check(vector<int> v){ sort(v.begin(), v.end()); if (v[1] - v[0] <= v[2] - v[1]){ cout << a[v[0]].first + a[v[1]].first + a[v[2]].first; exit(0); } } void solve(){ int n; cin >> n; vector<int> perm(n); for (int i = 1; i <= n; i++){ cin >> a[i].first; a[i].second = i; } sort(a + 1, a + n + 1); reverse(a + 1, a + n + 1); int q; cin >> q; for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ for (int k = j + 1; k <= n; k++){ check({a[i].second, a[j].second, a[k].second}); } } } } 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...