답안 #495565

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495565 2021-12-19T11:01:05 Z 600Mihnea 3단 점프 (JOI19_jumps) C++17
0 / 100
38 ms 4512 KB
#include <bits/stdc++.h>

using namespace std;

const int N = (int) 5e5 + 7;
const int INF = (int) 1e9 + 7;
int n;
int q;
int a[N];

signed main() {
  ios::sync_with_stdio(0); cin.tie(0);

  //freopen ("input", "r", stdin);


  vector<pair<int, int>> elements;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    elements.push_back({a[i], i});
  }

  sort(elements.rbegin(), elements.rend());

  if ((int) elements.size() >= 30) {
    elements.resize(30);
  }

  int sol = 0;


  for (int i = 0; i < (int) elements.size(); i++) {
    for (int j = 0; j < i; j++) {
      for (int k = 0; k < j; k++) {
        vector<int> all = {elements[i].second, elements[j].second, elements[k].second};
        sort(all.begin(), all.end());

        if (all[1] * 2 <= all[0] + all[2]) {
          sol = max(sol, elements[i].first + elements[j].first + elements[k].first);
        }

      }
    }
  }

  cout << sol << "\n";

  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Incorrect 1 ms 316 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Incorrect 1 ms 316 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 4304 KB Output is correct
2 Correct 22 ms 4512 KB Output is correct
3 Correct 24 ms 4504 KB Output is correct
4 Correct 37 ms 4496 KB Output is correct
5 Correct 36 ms 4432 KB Output is correct
6 Incorrect 33 ms 3780 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 312 KB Output is correct
2 Incorrect 1 ms 316 KB Output isn't correct
3 Halted 0 ms 0 KB -