Submission #800196

# Submission time Handle Problem Language Result Execution time Memory
800196 2023-08-01T11:41:15 Z TFF Floppy (RMI20_floppy) C++17
7 / 100
135 ms 2860 KB
#include <stdlib.h>
#include <string.h>
#include <bits/stdc++.h>
using namespace std;
#include "floppy.h"

void read_array(int subtask_id, const vector<int> &v) {
    string bits = "";
    priority_queue<pair<int, int>> q;
    for (int i = 0; i < (int)v.size(); i++) {
        q.push({v[i], i});
    }
    while (!q.empty()) {
        int aux = q.top().second; q.pop();
        for (int i = 8; i >= 0; i--) {
            if (aux >= (1 << i)) {
                aux -= (1 << i);
                bits += "1";
            } else bits += "0";
        }
    }
    save_to_floppy(bits);
}

vector<int> solve_queries(int subtask_id, int N,
        const string &bits,
        const vector<int> &a, const vector<int> &b) {
    vector<int> answers = {};
    vector<int> nums;
    for (int i = 0; i < N; i++) {
        int num = 0;
        for (int j = 0; j < 9; j++) {
            num += (bits[9 * i + j] == '1') * (1 << (8 - j));
        }
        nums.push_back(num);
    }
    for (int i = 0; i < (int)a.size(); i++) {
        for (int j = 0; j < N; j++) {
            if (nums[j] >= a[i] && nums[j] <= b[i]) {
                answers.push_back(nums[j]);
                break;
            }
        }
    }
    return answers;
}

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 Correct 2 ms 664 KB Output is correct
2 Correct 2 ms 660 KB Output is correct
3 Correct 2 ms 660 KB Output is correct
4 Correct 2 ms 668 KB Output is correct
5 Correct 2 ms 668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 135 ms 2860 KB Output isn't correct1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 26 ms 2672 KB L is too large
2 Halted 0 ms 0 KB -