# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
151722 | 2019-09-04T11:13:14 Z | leduykhongngu | 십자가 놓기 (FXCUP4_cross) | C++17 | 300 ms | 14948 KB |
#include <vector> #include <set> #include <algorithm> #include <assert.h> long long SelectCross(int K, std::vector<int> I, std::vector<int> O) { //i<o int n = I.size(); std::vector< std::pair<int, int > > rectangles; for (int i = 0; i < n; ++i) { rectangles.push_back({O[i], I[i]}); } sort(rectangles.begin(), rectangles.end()); //reverse(rectangles.begin(), rectangles.end()); std::multiset< int > myset; for (auto rec : rectangles) { myset.insert(rec.second); } int cnt = 0; long long res = 0; int last = 0; for (auto rec : rectangles) { //delete rec int Long = rec.first, Short = (K == 1? rec.second : *myset.begin()); assert(Long >= Short); res = std::max(res, 1ll * Long * Long - 1ll * (Long - Short) * (Long - Short)); myset.erase(myset.find(rec.second)); if (myset.size() < K) break; } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 376 KB | Output is correct |
5 | Correct | 13 ms | 1368 KB | Output is correct |
6 | Correct | 297 ms | 14804 KB | Output is correct |
7 | Correct | 295 ms | 14948 KB | Output is correct |
8 | Correct | 300 ms | 14836 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 | 3 ms | 376 KB | Output is correct |
5 | Correct | 13 ms | 1368 KB | Output is correct |
6 | Correct | 297 ms | 14804 KB | Output is correct |
7 | Correct | 295 ms | 14948 KB | Output is correct |
8 | Correct | 300 ms | 14836 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Incorrect | 2 ms | 376 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | 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 | 3 ms | 376 KB | Output is correct |
5 | Correct | 13 ms | 1368 KB | Output is correct |
6 | Correct | 297 ms | 14804 KB | Output is correct |
7 | Correct | 295 ms | 14948 KB | Output is correct |
8 | Correct | 300 ms | 14836 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Incorrect | 2 ms | 376 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |