Submission #201979

# Submission time Handle Problem Language Result Execution time Memory
201979 2020-02-13T00:48:36 Z Segtree Bubble Sort 2 (JOI18_bubblesort2) C++14
Compilation error
0 ms 0 KB
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
vll countScans(vll a,vll x,vll v){
    ll n=a.size(),q=x.size();
    if(n>8000)return a;
    vll fans;
    ll ans=0;
    rep(i,n)rep(j,i)if(a[j]>a[i])ans++;
    rep(k,q){
	ll id=x[k];
	for(int i=0;i<id;i++){
	    if(a[i]>a[id])ans--;
	    if(a[i]>v[k])ans++;
	}
	for(int i=id+1;i<n;i++){
	    if(a[i]<a[id])ans--;
	    if(a[i]<v[k])ans++;
	}
	fans.push_back(ans);
    }
    return fans;
}
/*int main(){
    ll n,q;
    cin>>n>>q;
    vll a(n),x(q),v(q);
    rep(i,n)cin>>a[i];
    rep(i,q)cin>>x[i]>>v[i];
    vll res=countScans(a,x,v);
    for(auto t:res)cout<<t<<endl;
}*/


Compilation message

/tmp/ccw7Dq7C.o: In function `main':
grader.cpp:(.text.startup+0x12b): undefined reference to `countScans(std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status