답안 #646805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646805 2022-09-30T17:44:09 Z VitaliyFS Floppy (RMI20_floppy) C++17
7 / 100
32 ms 3628 KB
#include<bits/stdc++.h>
#include "floppy.h"

using namespace std;

void read_array(int subtask_id, const std::vector<int> &v) {
    string bits="";
    for(auto u : v) {
        u+=1000000000;
        for(int i=0;i<=31;i++) {
            bits+=((u%2) + '0');
            u/=2;
        }
    }
    save_to_floppy(bits);
}

std::vector<int> solve_queries(int subtask_id, int N,
        const std::string &bits,
        const std::vector<int> &a, const std::vector<int> &b) {
    vector<int> arr;
    arr.resize(N);
    for(int i=0;i<N;i++) {
        int num = 0, pow = 1;
        for(int j=0;j<=31;j++) {
            num+=(bits[i*32+j] - '0')*pow;
            pow*=2;
        }
        arr[i]=num;
    }
    vector<int> answers(a.size());
    for(int i=0;i<a.size();i++) {
        int maxval = -1, maxid = 0;
        for(int j=a[i];j<=b[i];j++) {
            if(arr[j]>maxval) {
                maxval=arr[j];
                maxid=j;
            }
        }
        answers[i]=maxid;
    }
    return answers;
}

Compilation message

floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:32:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for(int i=0;i<a.size();i++) {
      |                 ~^~~~~~~~~
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 Correct 3 ms 808 KB Output is correct
2 Correct 3 ms 808 KB Output is correct
3 Correct 3 ms 772 KB Output is correct
4 Correct 3 ms 800 KB Output is correct
5 Correct 3 ms 808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1412 KB L is too large
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 32 ms 3628 KB L is too large
2 Halted 0 ms 0 KB -