TLE ON SIMPLE INPUT FOR WHICH IDE IS SHOWING CORRECT ANSWER??

Revision en1, by anshjain18, 2020-01-02 23:07:26

include<bits/stdc++.h>

using namespace std;

define fastio ios_base::sync_with_stdio(0); cin.tie(0);

define ll long long int

int main() {

fastio ll r,c; cin>>r>>c; if(r==1&&c==1) { cout<<0; return 0; } ll mat[r][c]={{0,0}, {0,0}};

if(r>c) { //if(c!=1) for(ll i=0;i<c;i++) { mat[0][i]=(i+1)*2; } ll a=2; for(ll i=0;i<r;i++) { mat[i][0]=a++; }

for(ll i=1;i<r;i++) for(ll j=1;j<c;j++) mat[i][j]=mat[i][0]*mat[0][j];

} else { //if(r!=1) for(ll i=0;i<r;i++) { mat[i][0]=(i+1)*2; } ll a=2; for(ll i=0;i<c;i++) { mat[0][i]=a++; }

for(ll i=1;i<r;i++)
    for(ll j=1;j<c;j++)
        mat[i][j]=mat[i][0]*mat[0][j];

}

for(auto& it:mat) { for(auto a:it) cout<<a<<" "; cout<<endl; }

return 0;

} Codeforces is showing me TLE on input 1,7. I dont know why. Can anybody help me problem link:- https://codeforces.net/contest/1266/problem/C

Tags #tle, 1266c

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English anshjain18 2020-01-02 23:09:07 922
en1 English anshjain18 2020-01-02 23:07:26 1092 Initial revision (published)