Any idea why the first gives TLE but the second doesn’t? Time is 1 sec.
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n;
cin>>t;
while(t--)
{
cin>>n;
lli i,a[2*n];
for(i=0;i<2*n;i+=2) cin>>a[i]>>a[i+1];
cout << 1 << endl;
}
return 0;
}
and
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli t,n;
cin>>t;
while(t--)
{
cin>>n;
lli i,a[2*n];
for(i=0;i<2*n;i+=2) cin>>a[i]>>a[i+1];
}
return 0;
}