답안 #495567

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
495567 2021-12-19T11:01:43 Z 600Mihnea 3단 점프 (JOI19_jumps) C++17
0 / 100
43 ms 4556 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());

  int lim = 100;

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

  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 204 KB Output is correct
2 Incorrect 6 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 6 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 3116 KB Output is correct
2 Correct 25 ms 4556 KB Output is correct
3 Correct 27 ms 4540 KB Output is correct
4 Correct 43 ms 4424 KB Output is correct
5 Correct 39 ms 4496 KB Output is correct
6 Incorrect 38 ms 3912 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 6 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -