Submission #857044

#TimeUsernameProblemLanguageResultExecution timeMemory
857044busamateFloppy (RMI20_floppy)C++14
0 / 100
23 ms4632 KiB
#include <stdlib.h> #include <string.h> #include <set> #include "floppy.h" using namespace std; set<int> szet; void read_array(int subtask_id, const std::vector<int> &v) { int N = v.size(); string bits('0', 2 * N); int tart = 0; 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); } vector<int> kerd[40000]; 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); for (int i = 0; i < Q; i++) kerd[bb[i]].push_back(i); 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 (stderr)

stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |     if (query_answers.size() != M) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...