Submission #646805

#TimeUsernameProblemLanguageResultExecution timeMemory
646805VitaliyFSFloppy (RMI20_floppy)C++17
7 / 100
32 ms3628 KiB
#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 (stderr)

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) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...