Submission #934546

#TimeUsernameProblemLanguageResultExecution timeMemory
934546MilosMilutinovicFloppy (RMI20_floppy)C++14
100 / 100
73 ms16144 KiB
#include "floppy.h" #include<bits/stdc++.h> #define pb push_back #define fi first #define se second #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; template <typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;} template <typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;} ll readint(){ ll x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } int go[100005][20]; void read_array(int subtask_id, const std::vector<int> &v){ int n=(int)v.size(); string ret=""; vector<int> stk; for(int i=0;i<n;i++){ while(!stk.empty()&&v[stk.back()]<v[i]){ stk.pop_back(); ret+='0'; } ret+='1'; stk.push_back(i); } save_to_floppy(ret); } vector<int> solve_queries(int subtask_id, int n, const std::string &bits, const std::vector<int> &a, const std::vector<int> &b){ int q=a.size(); vector<int> stk; int ptr=0; for(int i=0;i<n;i++){ while(bits[ptr]=='0') stk.pop_back(),ptr++; go[i][0]=(stk.empty()?-1:stk.back()); stk.push_back(i); ptr++; } for(int j=1;j<20;j++){ for(int i=0;i<n;i++){ go[i][j]=(go[i][j-1]==-1?-1:go[go[i][j-1]][j-1]); } } vector<int> res; for(int i=0;i<q;i++){ int x=b[i]; for(int j=19;j>=0;j--){ if(go[x][j]>=a[i]){ x=go[x][j]; } } res.pb(x); } return res; }

Compilation message (stderr)

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...