Submission #884024

#TimeUsernameProblemLanguageResultExecution timeMemory
884024vjudge1Bubble Sort 2 (JOI18_bubblesort2)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector<int>aib; void update(int pos,int val,int n) { int i=pos; while(i<=n) { aib[i]+=val; i+=(i&(-i)); } } int get(int pos,int n) { int i=pos,s=0; while(i>0) { s=s+aib[i]; i-=(i&(-i)); } return s; } int n,q; vector<int> countScans(vector<int>A, vector<int>X, vector<int>V) { vector<int>ans; for(int i=0;i<q;i++) { A[X[i]]=V[i]; aib.assign(n+1,0); int ans1=0;//cout<<"asa"; for(int j=0;j<n;j++) { ans1=max(ans1,get(n,n)-get(A[j],n)); // cout<<"asa"; update(A[j],1,n); } ans.push_back(ans1); // cout<<ans1<<'\n'; } return ans; } int main() { cin>>n>>q; vector<int>A(n); vector<int>Aux(n); vector<int>X(q); vector<int>V(q); for(int i=0;i<n;i++) { cin>>A[i]; Aux[i]=A[i]; } sort(Aux.begin(),Aux.end()); for(int i=0;i<n;i++) { int l=-1,r=n-1; while(l<r-1) { int mid=(l+r)/2; if(A[i]<=Aux[mid]) r=mid; else l=mid; } A[i]=r+1; // cout<<A[i]<<' '; } // cout<<'\n'; for(int i=0;i<q;i++) { cin>>X[i]>>V[i]; } // countScans(A,X,V); return 0; } /* 6 1 5 6 2 3 4 1 3 3 */

Compilation message (stderr)

/usr/bin/ld: /tmp/ccYOxHVB.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc3pkhKC.o:bubblesort2.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status