Submission #201981

# Submission time Handle Problem Language Result Execution time Memory
201981 2020-02-13T00:50:25 Z Segtree Bubble Sort 2 (JOI18_bubblesort2) C++14
0 / 100
12 ms 632 KB
#include "bubblesort2.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> 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;
}*/


# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -