Help Needed in observing TC of a Solution!
Difference between en1 and en2, changed 50 character(s)
~~~~~↵
Your code here...↵
~~~~~↵

I have tried this q :[Aquamoon and Stolen String](https://codeforces.com/problemset/problem/1546/B)↵

And wrote the following code:↵

<spoiler summary="CODE">↵
~~~~~↵
#include<bits/stdc++.h>↵
using namespace std; ↵

int main()↵
{↵
    ios_base::sync_with_stdio(false);↵
    cin.tie(NULL);cout.tie(NULL);↵
    long long T;↵
    cin >> T;↵
    for(long long _ = 1;_<=T;_++)↵
    {        ↵
        int n,m;↵
        cin>>n>>m;↵
        vector<vector<int>> ar( 100005 , vector<int> (30, 0));↵
        for(int i=0;i<n;i++)↵
        {↵
            string s;↵
            cin>>s;↵
            for(int j=0;j<m;j++){↵
                int mr = s[j] &mdash; 'a';↵
                ar[j][mr]++;↵
            }↵
        }↵
        for(int i=0;i<n-1;i++)↵
        {↵
            string s;↵
            cin>>s;↵
            for(int j=0;j<m;j++){↵
               int mr = s[j] &mdash; 'a';↵
                ar[j][mr]--;↵
            }↵
        }↵
        string ans;↵
        for(int i=0;i<m;i++)↵
        {↵
            for(int j=0;j<26;j++)↵
            {↵
                if(ar[i][j]>0){↵
                    char t = 97+j;↵
                    ans.push_back(t);↵
                }↵
            }↵
        }↵
        cout<<ans<<endl;↵
    }↵
    return 0;↵
}↵
~~~~~↵
</spoiler>↵


As per what I can observe my code is O(n*m) and in the q its mentioned that It is guaranteed that n is odd and that the sum of n⋅m over all test cases does not exceed 10^5.↵

But still my code is giving TLE in test case 2.↵

plz help me with its complexity↵

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English akash.garg2172 2021-08-02 15:04:48 0 (published)
en3 English akash.garg2172 2021-08-02 15:02:32 16 (saved to drafts)
en2 English akash.garg2172 2021-08-02 15:01:16 50 Tiny change: '\n~~~~~\nYou' -> '~~~~~\nYou'
en1 English akash.garg2172 2021-08-02 15:00:40 1562 Initial revision (published)