답안 #151466

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151466 2019-09-03T10:31:51 Z AlexPop28 십자가 놓기 (FXCUP4_cross) C++17
100 / 100
123 ms 9708 KB
#include <bits/stdc++.h>
#include "cross.h"

using namespace std;

long long Area(int in, int out) {
  return 1LL * out * out - 1LL * (out - in) * (out - in);
}

long long SelectCross(int k, vector<int> in, vector<int> out) {
  int n = in.size();
  vector<int> order(n);
  iota(order.begin(), order.end(), 0);
  sort(order.begin(), order.end(), [&](int a, int b) {
    return in[a] > in[b];
  });
  priority_queue<int, vector<int>, greater<int>> min_out;
  long long ans = 0LL;
  for (int i = 0; i < n; ++i) {
    if (i >= k) {
      min_out.pop();
    }
    min_out.emplace(out[order[i]]);
    if (i + 1 >= k) {
      ans = max(ans, Area(in[order[i]], min_out.top()));
    }
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 760 KB Output is correct
6 Correct 106 ms 8288 KB Output is correct
7 Correct 107 ms 8308 KB Output is correct
8 Correct 106 ms 8260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 760 KB Output is correct
6 Correct 106 ms 8288 KB Output is correct
7 Correct 107 ms 8308 KB Output is correct
8 Correct 106 ms 8260 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 9 ms 888 KB Output is correct
13 Correct 57 ms 4564 KB Output is correct
14 Correct 116 ms 8292 KB Output is correct
15 Correct 120 ms 8340 KB Output is correct
16 Correct 118 ms 8264 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 760 KB Output is correct
6 Correct 106 ms 8288 KB Output is correct
7 Correct 107 ms 8308 KB Output is correct
8 Correct 106 ms 8260 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 9 ms 888 KB Output is correct
13 Correct 57 ms 4564 KB Output is correct
14 Correct 116 ms 8292 KB Output is correct
15 Correct 120 ms 8340 KB Output is correct
16 Correct 118 ms 8264 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 9 ms 1016 KB Output is correct
20 Correct 65 ms 4540 KB Output is correct
21 Correct 90 ms 6636 KB Output is correct
22 Correct 115 ms 8264 KB Output is correct
23 Correct 122 ms 8204 KB Output is correct
24 Correct 123 ms 8284 KB Output is correct
25 Correct 122 ms 9652 KB Output is correct
26 Correct 117 ms 9708 KB Output is correct