Submission #947023

#TimeUsernameProblemLanguageResultExecution timeMemory
947023thunoproFloppy (RMI20_floppy)C++14
100 / 100
77 ms13684 KiB
#include <bits/stdc++.h> #include "floppy.h" using namespace std; void read_array ( int subtask_id , const std :: vector<int> &v ) { vector<int> q; string bits = ""; for(int x : v){ while(!q.empty() && q.back() < x) { q.pop_back(); bits += '0'; } q.push_back(x); bits += '1'; } save_to_floppy(bits); } std::vector<int> solve_queries ( int subtask_id , int N, const std::string &bits, const std::vector<int> &a, const std::vector<int> &b) { int m = (int)a.size(); vector<vector<int>> queries(N); for(int i = 0; i < m; i++){ queries[b[i]].push_back(i); } int idx = -1; vector<int> q, res(m); for(char b : bits){ if(b == '1'){ q.push_back(++idx); for(int i : queries[idx]){ res[i] = *lower_bound(q.begin(), q.end(), a[i]); } } else { q.pop_back(); } } return res; }

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...