# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
764258 | 2023-06-23T09:41:13 Z | idkhandle | Crosses on the Grid (FXCUP4_cross) | C++17 | 1000 ms | 18240 KB |
#include "cross.h" #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; const int INF = 1e9; ll SelectCross(int K, vector<int> I, vector<int> O) { int n = I.size(); vector<pii> a; for (int i = 0; i < n; i++) { a.emplace_back(I[i], O[i]); } sort(a.begin(), a.end()); multiset<int> st; ll ans = 0; for (int i = n - 1; i >= 0; i--) { if (st.size() >= K - 1) { auto it = st.rbegin(); for (int j = 0; j < K - 2; j++) { it = next(it); } ans = max(ans, a[i].first * (2LL * min((K == 1 ? INF : *it), a[i].second) - a[i].first)); } st.insert(a[i].second); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 5 ms | 1364 KB | Output is correct |
6 | Correct | 106 ms | 16088 KB | Output is correct |
7 | Correct | 123 ms | 16096 KB | Output is correct |
8 | Correct | 105 ms | 16172 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 5 ms | 1364 KB | Output is correct |
6 | Correct | 106 ms | 16088 KB | Output is correct |
7 | Correct | 123 ms | 16096 KB | Output is correct |
8 | Correct | 105 ms | 16172 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 5 ms | 1364 KB | Output is correct |
13 | Correct | 56 ms | 9408 KB | Output is correct |
14 | Correct | 107 ms | 18136 KB | Output is correct |
15 | Correct | 119 ms | 18240 KB | Output is correct |
16 | Correct | 122 ms | 18148 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 5 ms | 1364 KB | Output is correct |
6 | Correct | 106 ms | 16088 KB | Output is correct |
7 | Correct | 123 ms | 16096 KB | Output is correct |
8 | Correct | 105 ms | 16172 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 340 KB | Output is correct |
12 | Correct | 5 ms | 1364 KB | Output is correct |
13 | Correct | 56 ms | 9408 KB | Output is correct |
14 | Correct | 107 ms | 18136 KB | Output is correct |
15 | Correct | 119 ms | 18240 KB | Output is correct |
16 | Correct | 122 ms | 18148 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 2 ms | 340 KB | Output is correct |
19 | Correct | 152 ms | 1456 KB | Output is correct |
20 | Execution timed out | 1078 ms | 5500 KB | Time limit exceeded |
21 | Halted | 0 ms | 0 KB | - |