Submission #857044

# Submission time Handle Problem Language Result Execution time Memory
857044 2023-10-05T10:07:30 Z busamate Floppy (RMI20_floppy) C++14
0 / 100
23 ms 4632 KB
#include <stdlib.h>
#include <string.h>
#include <set>

#include "floppy.h"

using namespace std;

set<int> szet;

void read_array(int subtask_id, const std::vector<int> &v)
{
    int N = v.size();
    string bits('0', 2 * N);

    int tart = 0;
    szet.clear();
    for (int i = 0; i < N; i++)
    {
        while (!szet.empty() && v[*szet.rbegin()] < v[i])
        {
            bits[tart++] = '1';
            auto it = szet.end();
            it--;
            szet.erase(it);
        }
        szet.insert(i);
        tart++;
    }

    save_to_floppy(bits);
}

vector<int> kerd[40000];

std::vector<int> solve_queries(int subtask_id, int N,
                               const std::string &bits,
                               const std::vector<int> &aa, const std::vector<int> &bb)
{
    int Q = aa.size();
    std::vector<int> ans(Q);

    for (int i = 0; i < Q; i++)
        kerd[bb[i]].push_back(i);

    szet.clear();
    int tart = 0;
    for (int i = 0; i < N; i++)
    {
        while (bits[tart] == '1')
        {
            auto it = szet.end();
            it--;
            szet.erase(it);
            tart++;
        }
        tart++;
        szet.insert(i);
        for (int j : kerd[i])
        {
            ans[j] = (*szet.lower_bound(aa[j]));
        }
    }

    return ans;
}

Compilation message

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 time Memory Grader output
1 Runtime error 2 ms 2396 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 7 ms 2908 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 23 ms 4632 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -