제출 #1253547

#제출 시각아이디문제언어결과실행 시간메모리
1253547JuanJLBubble Sort 2 (JOI18_bubblesort2)C++20
17 / 100
9091 ms3036 KiB
#include "bubblesort2.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define fst first #define snd second #define pb push_back #define SZ(x) (int)x.size() #define ALL(x) x.begin(),x.end() #define forn(i,a,b) for(int i = a; i< b; i++) #define mset(a,v) memset(a,v,sizeof(a)) #define FIN ios::sync_with_stdio(0); cout.tie(0); cin.tie(0); using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef tree<pair<ll,ll>,null_type,less<pair<ll,ll>>,rb_tree_tag,tree_order_statistics_node_update> iset; ll solve(vector<int> A){ vector<pair<ll,ll>> rA; forn(i,0,SZ(A)) rA.pb({A[i],i}); iset is; forn(i,0,SZ(rA)){ } forn(i,0,SZ(rA)){ is.insert(rA[i]); //cout<<rA[i].fst<<" "<<rA[i].snd<<" "<<is.order_of_key(rA[i])<<'\n'; rA[i].snd=SZ(is)-(is.order_of_key(rA[i])+1); //cout<<rA[i].fst<<" "<<rA[i].snd<<'\n'; /*forn(j,0,i){ if(rA[j].fst>rA[i].fst){ rA[i].snd++; } }*/ } sort(ALL(rA)); ll res = 0; ll maxi = -1; forn(i,0,SZ(rA)){ res+=max((ll)0,rA[i].snd-res); } return res; } std::vector<int> countScans(std::vector<int> A,std::vector<int> X,std::vector<int> V){ vector<int> nA = A; vector<int> res; forn(i,0,SZ(X)){ nA[X[i]]=V[i]; res.pb(solve(nA)); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...