My issue
This code has passed 2 out of 6 test cases and the 3rd one got time exceeded warning, can anyone help?
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
long long int t;
cin >> t;
while (t--){
long long int N;
cin >> N;
vector<long long int> arr(N);
for (long long int &i: arr)
cin >> i;
long long int count=0;
for (int i=0; i<N; i++){
for (int j=0; j<N; j++){
long long int a = pow(arr[i],j+1);
if (a <= arr[j]){
count++;
}
}
}
cout << count << endl;
}
}
Problem Link: Powered Parameters Practice Coding Problem - CodeChef