結果

問題 No.1825 Except One
ユーザー MasKoaTSMasKoaTS
提出日時 2022-01-28 22:43:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,254 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 84,944 KB
最終ジャッジ日時 2023-08-28 21:12:08
合計ジャッジ時間 9,839 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 215 ms
82,876 KB
testcase_01 AC 219 ms
83,224 KB
testcase_02 AC 222 ms
83,032 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 221 ms
82,804 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 215 ms
82,872 KB
testcase_18 AC 217 ms
82,936 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 218 ms
83,060 KB
testcase_22 WA -
testcase_23 AC 217 ms
82,976 KB
testcase_24 AC 227 ms
84,068 KB
testcase_25 WA -
testcase_26 AC 217 ms
82,936 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 216 ms
82,964 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from copy import deepcopy as dcopy
import math
import sys
sys.setrecursionlimit(10**6)
def input():
    return sys.stdin.readline().rstrip()
def getN():
	return int(sys.stdin.readline())
def getNs():
	return map(int,sys.stdin.readline().split())
def getList():
	return list(map(int,sys.stdin.readline().split()))
def strinps(n):
	return [sys.stdin.readline().rstrip() for _ in range(n)]
pi = 3.141592653589793
mod = 10**9+7
MOD = 998244353
INF = math.inf
dx = [1,0,-1,0];	dy = [0,1,0,-1]


"""
Main Code
"""

n = getN()
a = list(sorted(getList()))
#print(a)

if(n == 2):
	print(1)
	exit(0)

st = set([])
ans = n * (n - 1) // 2
cnt = [0] * (max(a) + 1)
for i in a:
	cnt[i] += 1
for i in range(n - 2):
	for j in range(i + 1, n - 1):
		for k in range(j + 1, n):
			tup = tuple([a[i], a[j], a[k]])
			s = 0
			for t in tup:
				s += t - tup[-1]
			if(tup[-1] + s != 0 or tup in st):
				continue
			if(tup[0] == tup[-1]):
				ans += (1 << cnt[-1]) - 1 - cnt[-1] - cnt[-1] * (cnt[-1] - 1) // 2
			elif(tup[1] == tup[-1]):
				ans += (1 << cnt[-1]) - 1 - cnt[-1]
			else:
				ans += (1 << cnt[tup[-1]]) - 1
			st.add(tup)
print(ans)
0