답안 #1056974

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056974 2024-08-13T12:47:06 Z kititnik Floppy (RMI20_floppy) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
 
#include "floppy.h"
using namespace std;
 
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";
    }
    save_to_floppy(s);
}
 
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

floppy.cpp: In function 'void read_array(int, const std::vector<int>&)':
floppy.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i = 0; i < v.size(); i++)
      |                    ~~^~~~~~~~~~
floppy.cpp:19:20: error: 's' was not declared in this scope; did you mean 'st'?
   19 |     save_to_floppy(s);
      |                    ^
      |                    st
floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     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) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~