Submission #642895

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6428952022-09-20 17:34:34lis05stFloppy (RMI20_floppy)C++17
100 / 100
129 ms21192 KiB
#include <stdlib.h>
#include <string.h>
#include "floppy.h"
#include<bits/stdc++.h>
using namespace std;
const int NMAX=2e5;
int ARR[NMAX+5],L[NMAX+5],R[NMAX+5],pr[NMAX+5];
string floppy;
vector<int>vec;
void dfs(int v){
floppy+='0'+(L[v]==-1?0:1);
floppy+='0'+(R[v]==-1?0:1);
if(L[v]!=-1)dfs(L[v]);
vec.push_back(ARR[v]);
if(R[v]!=-1)dfs(R[v]);
}
int sL[NMAX+5],sR[NMAX+5],spr[20][NMAX+5];
int TIME=1,ID=0;
vector<int>arr;
int dfs2(string&s){
bool haveLeft=s[ID]=='1';
bool haveRight=s[ID+1]=='1';
ID+=2;
if(haveLeft){
int x=dfs2(s);
sL[TIME]=x;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

floppy.cpp: In function 'void read_array(int, const std::vector<int>&)':
floppy.cpp:85:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |     for(int i=0;i<v.size();i++)mp[vec2[i]]=i;
      |                 ~^~~~~~~~~
In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from floppy.cpp:5:
floppy.cpp: In function 'std::vector<int> solve_queries(int, int, const string&, const std::vector<int>&, const std::vector<int>&)':
floppy.cpp:123:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  123 |     assert(arr.size()==N);
      |            ~~~~~~~~~~^~~
floppy.cpp:127:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  127 |     for(int i=0;i<a.size();i++)answers[i]=lca(a[i]+1,b[i]+1)-1;
      |                 ~^~~~~~~~~
floppy.cpp:125:9: warning: unused variable 'n' [-Wunused-variable]
  125 |     int n=bits.size()/2;
      |         ^
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...