Submission #68110014


Source Code Expand

#include<stdio.h>
#include<map>
using namespace std;
// inline char nc()
// {
// 	static char*l,*r,buf[99999];
// 	return l==r&&(r=(l=buf)+fread(buf,1,99999,stdin),l==r)?EOF:*l++;
// }
#define nc getchar
inline void read(int&x)
{
	char c=nc();for(;c<'0'||'9'<c;c=nc());
	for(x=0;'0'<=c&&c<='9';x=(x<<3)+(x<<1)+(c^48),c=nc());
}
int n,x;map<int,int>mmp;long long ans;
main()
{
	read(n);
	for(int i=0;i<n;++i)
	{
		read(x);
		ans+=mmp[i-x];
		++mmp[i+x];
	}
	printf("%lld",ans);
}

Submission Info

Submission Time
Task C - Distance Indicators
User TOMWT
Language C++ 20 (gcc 12.2)
Score 300
Code Size 503 Byte
Status AC
Exec Time 213 ms
Memory 18844 KiB

Compile Error

Main.cpp:16:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   16 | main()
      | ^~~~

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 3088 KiB
00_sample_01.txt AC 1 ms 3028 KiB
00_sample_02.txt AC 1 ms 3160 KiB
01_random_03.txt AC 107 ms 11732 KiB
01_random_04.txt AC 137 ms 13040 KiB
01_random_05.txt AC 63 ms 9668 KiB
01_random_06.txt AC 152 ms 13576 KiB
01_random_07.txt AC 210 ms 15980 KiB
01_random_08.txt AC 213 ms 15960 KiB
01_random_09.txt AC 213 ms 15904 KiB
01_random_10.txt AC 200 ms 15848 KiB
01_random_11.txt AC 44 ms 11916 KiB
01_random_12.txt AC 9 ms 4984 KiB
01_random_13.txt AC 42 ms 10520 KiB
01_random_14.txt AC 6 ms 4924 KiB
01_random_15.txt AC 51 ms 12516 KiB
01_random_16.txt AC 60 ms 9432 KiB
01_random_17.txt AC 33 ms 7116 KiB
01_random_18.txt AC 3 ms 3468 KiB
01_random_19.txt AC 42 ms 8048 KiB
01_random_20.txt AC 77 ms 10804 KiB
01_random_21.txt AC 72 ms 10868 KiB
01_random_22.txt AC 78 ms 10904 KiB
01_random_23.txt AC 54 ms 11000 KiB
01_random_24.txt AC 86 ms 18844 KiB
01_random_25.txt AC 41 ms 11296 KiB
01_random_26.txt AC 41 ms 11340 KiB
01_random_27.txt AC 42 ms 11308 KiB
01_random_28.txt AC 41 ms 11324 KiB