#include
#include
using namespace std;
#define ll long long
ll a[1000005];
ll cum[1000005];
ll fre[1000005];
int main() {
#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif
int t;
cin >> t;
while (t > 0) {
memset(fre, 0, sizeof(fre));
int n;
cin >> n;
ll sum = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
cum[i] = sum;
sum %= n;
sum = (sum + n) % n;
fre[sum]++;
}
ll ans = 0;
ll var;
ll index;
for (int i = 0; i < n; i++) {
if ( i == 0) {
ll m = fre[i];
if (m > 0) {
var = 1;
index = i;
break;
}
} else {
ll m = fre[i];
if (m > 1) {
index = i;
var = 1;
break;
}
}
}
//cout << index << endl;
for (int i = 0; i < n; i++) {
if (cum[i] % n == index) {
//cout << i << endl;
if (index == 0) {
ans = 1;
} else {
ans = i + 2;
break;
}
}
}
cout << var << endl;
cout << ans << endl;
t--;
}
}
/*Inputs:
1
3
4 6 10
Outputs:
1
2*/
when i try to submit the above code in the codechef it is
showing TLE error but my code is running perfectly for the
given test cases , please say where is the error