Help me in solving POWPM problem

My issue

not passing for just last test case. Help me find the bug

My code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
	ll t;
	cin>>t;
	while(t--){
	    ll n;
	    cin>>n;
	    vector<ll>arr(n);
	    vector<ll>root(n);
	    for(int i=0;i<n;i++){
	        cin>>arr[i];
	        root[i]=pow(arr[i],1.0/(i+1));
	    }
	    ll ans=0;
	    sort(root.begin(),root.end());
	    for(int i=0;i<n;i++){
	        ans+=(root.end()-lower_bound(root.begin(),root.end(),arr[i]));
	    }
	    cout<<ans<<endl;
	}
	return 0;
}

Problem Link: Powered Parameters Practice Coding Problem