Need Help in a Question that one of my friend gave me!!

Правка en2, от LZD_DeViL0902, 2020-07-08 18:24:45

x is and Element of Array 1 and y is the element of array 2, Find the number of ways in the two arrays where x^y>y^x (NOTE: ^ denotes power here and not the XOR)

First line inputs the number of test cases, second line input the number of elements in two upcoming arrays third line inputs the first array fourth line inputs the second array

EXAMPLE: sampleINPUT: 1 3 2 2 1 6 1 5

sampleOUTPUT 3

<<HERE IS MY POOR CODE,JUST A BRUTE FORCE!!>> IS THERE ANY WAY TO SOLVE IT IN TIME LESS THAN THIS??

#include<bits/stdc++.h>
using namespace std;

int main()
{

    int t;
    cin>>t;
    while(t--)
    {
        int m,n;
        cin>>m>>n;
        vector<int> vm(m,0);
        vector<int> vn(n,0);
        for(auto &it:vm)
            cin>>it;
        for(auto &it:vn)
            cin>>it;
            int counts=0;
        for(int x:vm)
            for(int y:vn)
        {

            if(pow(x,y)>(pow(y,x)))
            {
                counts++;

            }
            continue;
        }
        cout<<counts<<endl;
    }
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский LZD_DeViL0902 2020-07-08 19:08:23 22
en2 Английский LZD_DeViL0902 2020-07-08 18:24:45 4 Tiny change: 'THIS??**\n~~~~~\n#' -> 'THIS??**\n\n\n~~~~~\n#'
en1 Английский LZD_DeViL0902 2020-07-08 18:23:52 1165 Initial revision (published)