# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
401506 | 2021-05-10T12:43:31 Z | Berted | Floppy (RMI20_floppy) | C++14 | 115 ms | 13020 KB |
#include <stdlib.h> #include <string.h> #include <algorithm> #include <iostream> #include "floppy.h" #define pii pair<int, int> #define ppi pair<pii, int> #define fst first #define snd second using namespace std; void read_array(int subtask_id, const vector<int> &v) { vector<int> S; string ret = ""; for (const auto &u : v) { while (S.size() && S.back() <= u) {S.pop_back(); ret.push_back('0');} S.push_back(u); ret.push_back('1'); } save_to_floppy(ret); } vector<int> solve_queries(int subtask_id, int N, const string &bits, const vector<int> &a, const vector<int> &b) { //cerr << "S: " << bits << "\n"; vector<int> ret(a.size(), 0), S; vector<ppi> qry; for (int i = 0; i < a.size(); i++) qry.push_back({{b[i], a[i]}, i}); sort(qry.begin(), qry.end()); int j = 0, k = 0; for (const auto &u : qry) { for (; j <= u.fst.fst; j++) { for (; k < bits.size() && bits[k] == '0'; k++) {S.pop_back();} S.push_back(j); k++; } ret[u.snd] = *lower_bound(S.begin(), S.end(), u.fst.snd); //cerr << u.snd << " " << ret[u.snd] << "\n"; } return ret; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 764 KB | Output is correct |
2 | Correct | 3 ms | 772 KB | Output is correct |
3 | Correct | 2 ms | 764 KB | Output is correct |
4 | Correct | 3 ms | 764 KB | Output is correct |
5 | Correct | 3 ms | 636 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 28 ms | 3668 KB | Output is correct |
2 | Correct | 28 ms | 3632 KB | Output is correct |
3 | Correct | 29 ms | 3496 KB | Output is correct |
4 | Correct | 28 ms | 3512 KB | Output is correct |
5 | Correct | 31 ms | 3620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 111 ms | 13020 KB | Output is correct |
2 | Correct | 112 ms | 12732 KB | Output is correct |
3 | Correct | 112 ms | 12784 KB | Output is correct |
4 | Correct | 115 ms | 12728 KB | Output is correct |
5 | Correct | 112 ms | 12768 KB | Output is correct |