# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150202 | 2019-09-01T07:53:30 Z | usa1+samsung2(#3703, adman, nona1314, wowoto9772) | Crosses on the Grid (FXCUP4_cross) | C++17 | 6 ms | 384 KB |
#include "cross.h" #include <algorithm> long long SelectCross(int K, std::vector<int> I, std::vector<int> O) { std::vector<std::pair<int, int>> v1(I.size()); std::vector<std::pair<int, int>> v2(I.size()); int N = I.size(); for (int i = 0; i < I.size(); i++) { v1[i].first = I[i]; v1[i].second = O[i]; } for (int i = 0; i < I.size(); i++) { v2[i].first = O[i]; v2[i].second = I[i]; } std::sort(v1.rbegin(), v1.rend()); std::sort(v2.rbegin(), v2.rend()); long long l1 = v1[0].first, l2 = v1[0].second; for (int i = 1; i < K; i++) { if (l1 > v1[i].first) l1 = v1[i].first; if (l2 > v1[i].second) l2 = v1[i].second; } long long ans = l2 * l2 - (l2 - l1)*(l2 - l1); l1 = v1[0].first, l2 = v1[0].second; for (int i = 1; i < K; i++) { if (l1 > v1[i].first) l1 = v1[i].first; if (l2 > v1[i].second) l2 = v1[i].second; } if (ans < l1 * l1 - (l1 - l2)*(l1 - l2)) ans = l1 * l1 - (l1 - l2)*(l1 - l2); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Incorrect | 6 ms | 384 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Incorrect | 6 ms | 384 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Incorrect | 6 ms | 384 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |