二、代码 1#include<iostream>2#include<cstring>3#include<algorithm>4#include<cstdio>5#defineLL long long6usingnamespacestd;7constintN=400050;8constintbase=N/2;//偏移量9ints[N];10intn;11LL res;12intmain(){1314intT;15scanf("%d",&T);16while(T--){17res=0;18memset(s,0,sizeof(s...
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤n) — array a. It is guaranteed that the sum of n over all test cases does not exceed 2⋅105. Output For each test case output the number of pairs of indices (i,j) such that i<j and aj−ai=j−...
I can, however, spot three main differences. First, the other solution uses int for all the values, whereas mine uses long or long long depending on the range. I tried changing all to int in my code but as I had expected it gave wrong answers for large numbers.. I can't understand...