結果

問題 No.2203 POWER!!!!!
ユーザー Shirotsume
提出日時 2023-02-03 23:10:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 2,127 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 81,940 KB
実行使用メモリ 102,116 KB
最終ジャッジ日時 2024-07-02 21:15:07
合計ジャッジ時間 2,418 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

class dsu():
n=1
parent_or_size=[-1 for i in range(n)]
def __init__(self,N):
self.n=N
self.num = N
self.parent_or_size=[-1 for i in range(N)]
def merge(self,a,b):
assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
assert 0<=b<self.n, "0<=b<n,b={0},n={1}".format(b,self.n)
x=self.leader(a)
y=self.leader(b)
if x==y:
return x
self.num -= 1
if (-self.parent_or_size[x]<-self.parent_or_size[y]):
x,y=y,x
self.parent_or_size[x]+=self.parent_or_size[y]
self.parent_or_size[y]=x
return x
def same(self,a,b):
assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
assert 0<=b<self.n, "0<=b<n,b={0},n={1}".format(b,self.n)
return self.leader(a)==self.leader(b)
def leader(self,a):
assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
if (self.parent_or_size[a]<0):
return a
self.parent_or_size[a]=self.leader(self.parent_or_size[a])
return self.parent_or_size[a]
def size(self,a):
assert 0<=a<self.n, "0<=a<n,a={0},n={1}".format(a,self.n)
return -self.parent_or_size[self.leader(a)]
def groups(self):
leader_buf=[0 for i in range(self.n)]
group_size=[0 for i in range(self.n)]
for i in range(self.n):
leader_buf[i]=self.leader(i)
group_size[leader_buf[i]]+=1
result=[[] for i in range(self.n)]
for i in range(self.n):
result[leader_buf[i]].append(i)
result2=[]
for i in range(self.n):
if len(result[i])>0:
result2.append(result[i])
return result2
def count(self):
return self.num
import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
n = ii()
a = li()
a = Counter(a)
ans = 0
for i in range(10):
for j in range(10):
ans += pow(i, j) * a[i] * a[j]
print(ans)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0