Submission #68111199


Source Code Expand

#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
const int maxn = 2e5+5;
int a[maxn],b[maxn];
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin>>n;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
        b[i]=i-a[i];
        a[i]+=i;
    }
    gp_hash_table<int,int> mp;
    long long ans=0;
    for (int i=n;i;i--)
    {
        ans+=mp[a[i]];
        mp[b[i]]++;
    }
    cout<<ans;
}

Submission Info

Submission Time
Task C - Distance Indicators
User Alliy666
Language C++ 23 (gcc 12.2)
Score 300
Code Size 559 Byte
Status AC
Exec Time 1926 ms
Memory 23236 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 29
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3400 KiB
00_sample_01.txt AC 1 ms 3488 KiB
00_sample_02.txt AC 1 ms 3500 KiB
01_random_03.txt AC 20 ms 13348 KiB
01_random_04.txt AC 22 ms 13600 KiB
01_random_05.txt AC 18 ms 13100 KiB
01_random_06.txt AC 23 ms 13676 KiB
01_random_07.txt AC 36 ms 23236 KiB
01_random_08.txt AC 36 ms 23148 KiB
01_random_09.txt AC 36 ms 23124 KiB
01_random_10.txt AC 36 ms 23056 KiB
01_random_11.txt AC 17 ms 13956 KiB
01_random_12.txt AC 4 ms 5764 KiB
01_random_13.txt AC 15 ms 13692 KiB
01_random_14.txt AC 5 ms 5804 KiB
01_random_15.txt AC 17 ms 14140 KiB
01_random_16.txt AC 22 ms 13740 KiB
01_random_17.txt AC 12 ms 8636 KiB
01_random_18.txt AC 2 ms 3904 KiB
01_random_19.txt AC 14 ms 8732 KiB
01_random_20.txt AC 24 ms 14004 KiB
01_random_21.txt AC 24 ms 13980 KiB
01_random_22.txt AC 25 ms 14092 KiB
01_random_23.txt AC 24 ms 13992 KiB
01_random_24.txt AC 1926 ms 22880 KiB
01_random_25.txt AC 19 ms 13996 KiB
01_random_26.txt AC 19 ms 14012 KiB
01_random_27.txt AC 19 ms 14084 KiB
01_random_28.txt AC 19 ms 14064 KiB