#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <vector>
#include <stack>
using namespace std;
#define ll long long
#define mp make_pair
#define fi first
#define pii pair<int,int>
#define se second
//const int INF=1000000000000000000;
const int INF=1e9;
const int N=1000000;
const int M=998244353;
const int ln=20;
template<typename T>
std::ostream& operator<< (std::ostream& os,pair<T,T> p){
return os << p.fi << "," << p.se << " ";
}
int get(vector<int> a){
// I need to know how many atleast than an element x
// for this, store in a sorted array
vector<int> ts=a;
sort(ts.begin(),ts.end());
int ans=0;
int n=a.size();
int mn=INF;
for(int i=n-1;i>=0;i--){
if(a[i]>=mn) continue;
// we need how many atleast mn
int cnt=n-(lower_bound(ts.begin(),ts.end(),mn)-ts.begin());
ans=max(ans,cnt-(n-1-i));
mn=a[i];
}
return ans;
}
vector<int> countScans(vector<int> a,vector<int> x,vector<int> v){
vector<int> ans;
int q=x.size();
for(int i=0;i<q;i++){
a[x[0]]=v[0];
ans.push_back(get(a));
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |