답안 #1056994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1056994 2024-08-13T12:56:18 Z kititnik Floppy (RMI20_floppy) C++14
0 / 100
1000 ms 7772 KB
#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";
    }
    save_to_floppy(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.empty())
            {
                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: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) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 129 ms 2388 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1121 ms 7772 KB Time limit exceeded
2 Halted 0 ms 0 KB -