Submission #209462

#TimeUsernameProblemLanguageResultExecution timeMemory
209462TAISA_Bubble Sort 2 (JOI18_bubblesort2)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define eb emplace_back #define all(v) v.begin(),v.end() using namespace std; using ll=long long; using D=long double; using P=pair<ll,ll>; struct BIT{ vector<int> bit; BIT(int n){ bit.resize(++n); } void add(int k,int x){ for(++k;k<bit.size();k+=k&-k){ bit[k]+=x; } } int get(int k){ int res=0; for(++k;k>0;k-=k&-k){ res+=bit[k]; } return res; } }; vector<int> countScans(vector<int> A,vector<int> X,vector<int> V){ int n=A.size(),q=X.size(): assert(n<=2000&&q<=2000); vector<int> v; for(int i=0;i<n;i++){ v.eb(A[i]); } for(int i=0;i<q;i++){ v.eb(Y[i]); } sort(all(v)); v.erase(unique(all(v)),v.end()); int m=v.size(); for(int i=0;i<n;i++){ A[i]=lower_bound(all(v),A[i])-v.begin(); } vector<int> res(q); for(int i=0;i<q;i++){ Y[i]=lower_bound(all(v),Y[i])-v.begin(); A[X[i]]=Y[i]; for(int j=0;j<n;j++){ res[i]=max(res[i],bit.get(m+1)-bit.get(A[j])); } } return res; }

Compilation message (stderr)

bubblesort2.cpp: In member function 'void BIT::add(int, int)':
bubblesort2.cpp:14:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(++k;k<bit.size();k+=k&-k){
           ~^~~~~~~~~~~
bubblesort2.cpp: In function 'std::vector<int> countScans(std::vector<int>, std::vector<int>, std::vector<int>)':
bubblesort2.cpp:27:27: error: expected ',' or ';' before ':' token
  int n=A.size(),q=X.size():
                           ^
bubblesort2.cpp:34:8: error: 'Y' was not declared in this scope
   v.eb(Y[i]);
        ^
bubblesort2.cpp:44:3: error: 'Y' was not declared in this scope
   Y[i]=lower_bound(all(v),Y[i])-v.begin();
   ^
bubblesort2.cpp:47:22: error: 'bit' was not declared in this scope
    res[i]=max(res[i],bit.get(m+1)-bit.get(A[j]));
                      ^~~