답안 #800188

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
800188 2023-08-01T11:27:19 Z TFF Floppy (RMI20_floppy) C++17
0 / 100
27 ms 2964 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) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 2964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 27 ms 2708 KB L is too large
2 Halted 0 ms 0 KB -