Submission #1056965

#TimeUsernameProblemLanguageResultExecution timeMemory
1056965kititnikFloppy (RMI20_floppy)C++14
Compilation error
0 ms0 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; } int main() { read_array(0, {40, 20, 30, 10}); auto ans = solve_queries(0, 4, "11011", {0, 0, 0, 0, 1, 1, 1, 2, 2, 3}, {0, 1, 2, 3, 1, 2, 3, 2, 3, 3}); cout << "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) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
/usr/bin/ld: /tmp/cctGmLeS.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDTL7SR.o:floppy.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status