# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
832428 | 2023-08-21T10:15:50 Z | _martynas | 십자가 놓기 (FXCUP4_cross) | C++17 | 65 ms | 4340 KB |
#include "cross.h" #include <vector> #include <algorithm> #include <numeric> #include <set> using namespace std; long long SelectCross(int K, vector<int> I, vector<int> O) { int N = I.size(); long long mx = 0; vector<int> orderI(N); iota(orderI.begin(), orderI.end(), 0); sort(orderI.begin(), orderI.end(), [&](int i, int j) { return I[i] > I[j]; }); long long mndi = 1e15; multiset<long long> maxo; for(int i = 0, j = 0; i < N; i++) { mndi = I[orderI[i]]; if(maxo.size() < K || (*maxo.begin()) < O[orderI[i]]) { maxo.insert(O[orderI[i]]); if(maxo.size() > K) maxo.erase(maxo.begin()); } mx = max(mx, mndi*(2*(*maxo.begin())-mndi)); } return mx; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 4 ms | 468 KB | Output is correct |
6 | Correct | 55 ms | 4268 KB | Output is correct |
7 | Correct | 57 ms | 4208 KB | Output is correct |
8 | Correct | 65 ms | 4340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 4 ms | 468 KB | Output is correct |
6 | Correct | 55 ms | 4268 KB | Output is correct |
7 | Correct | 57 ms | 4208 KB | Output is correct |
8 | Correct | 65 ms | 4340 KB | Output is correct |
9 | Incorrect | 1 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 4 ms | 468 KB | Output is correct |
6 | Correct | 55 ms | 4268 KB | Output is correct |
7 | Correct | 57 ms | 4208 KB | Output is correct |
8 | Correct | 65 ms | 4340 KB | Output is correct |
9 | Incorrect | 1 ms | 212 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |