# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
857050 | 2023-10-05T10:19:01 Z | busamate | Floppy (RMI20_floppy) | C++14 | 82 ms | 15704 KB |
#include <stdlib.h> #include <string.h> #include <set> #include "floppy.h" using namespace std; void read_array(int subtask_id, const std::vector<int> &v) { int N = v.size(); string bits(2 * N, '0'); int tart = 0; set<int> szet; szet.clear(); for (int i = 0; i < N; i++) { while (!szet.empty() && v[*szet.rbegin()] < v[i]) { bits[tart++] = '1'; auto it = szet.end(); it--; szet.erase(it); } szet.insert(i); tart++; } save_to_floppy(bits); } std::vector<int> solve_queries(int subtask_id, int N, const std::string &bits, const std::vector<int> &aa, const std::vector<int> &bb) { int Q = aa.size(); std::vector<int> ans(Q); vector<int> kerd[40000]; for (int i = 0; i < N; i++) kerd[i].clear(); for (int i = 0; i < Q; i++) kerd[bb[i]].push_back(i); set<int> szet; szet.clear(); int tart = 0; for (int i = 0; i < N; i++) { while (bits[tart] == '1') { auto it = szet.end(); it--; szet.erase(it); tart++; } tart++; szet.insert(i); for (int j : kerd[i]) { ans[j] = (*szet.lower_bound(aa[j])); } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1840 KB | Output is correct |
2 | Correct | 2 ms | 1852 KB | Output is correct |
3 | Correct | 2 ms | 1852 KB | Output is correct |
4 | Correct | 2 ms | 1852 KB | Output is correct |
5 | Correct | 2 ms | 1848 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 3572 KB | Output is correct |
2 | Correct | 19 ms | 4548 KB | Output is correct |
3 | Correct | 22 ms | 5056 KB | Output is correct |
4 | Correct | 20 ms | 4620 KB | Output is correct |
5 | Correct | 18 ms | 4532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 69 ms | 9800 KB | Output is correct |
2 | Correct | 74 ms | 13128 KB | Output is correct |
3 | Correct | 82 ms | 15704 KB | Output is correct |
4 | Correct | 77 ms | 13624 KB | Output is correct |
5 | Correct | 77 ms | 13116 KB | Output is correct |