Submission #1056966

#TimeUsernameProblemLanguageResultExecution timeMemory
1056966kititnikFloppy (RMI20_floppy)C++14
0 / 100
16 ms2152 KiB
#include <bits/stdc++.h> #include "floppy.h" using namespace std; #define ll long long void read_array(int sub, const vector<int> &v) { string bits; stack<int> st; for(int i = 0; i < v.size(); i++) { while(!st.empty() && v[i] > v[st.top()]) { st.pop(); bits += "0"; } st.push(i); bits += "1"; } cout << bits; } vector<int> solve_queries(int sub, int n, const string &bits, const vector<int> &a, const vector<int> &b) { vector<int> ans; for(int q = 0; q < a.size(); q++) { deque<int> qu; int zeros = 0; for(int i = 0; i <= a[q]; i++) { if(bits[i] == '0') zeros++; } int start = a[q] + zeros; int end = b[q]+zeros; int p = start; for(int i = start; i <= end; i++) { while(bits[p] == '0') { qu.pop_back(); p++; } qu.push_back(i-zeros); p++; } ans.push_back(qu.front()); } return ans; }

Compilation message (stderr)

floppy.cpp: In function 'void read_array(int, const std::vector<int>&)':
floppy.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i = 0; i < v.size(); i++)
      |                    ~~^~~~~~~~~~
floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:25:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for(int q = 0; q < a.size(); q++)
      |                    ~~^~~~~~~~~~
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...