結果

問題 No.1359 [Zelkova 3rd Tune] 四人セゾン
ユーザー KeroruKeroru
提出日時 2021-01-22 21:29:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 683 ms / 2,000 ms
コード長 3,397 bytes
コンパイル時間 1,364 ms
コンパイル使用メモリ 86,656 KB
実行使用メモリ 144,624 KB
最終ジャッジ日時 2023-08-27 17:33:30
合計ジャッジ時間 43,459 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
83,140 KB
testcase_01 AC 199 ms
83,232 KB
testcase_02 AC 198 ms
82,960 KB
testcase_03 AC 416 ms
121,164 KB
testcase_04 AC 418 ms
121,172 KB
testcase_05 AC 405 ms
120,028 KB
testcase_06 AC 389 ms
120,120 KB
testcase_07 AC 487 ms
134,280 KB
testcase_08 AC 481 ms
134,752 KB
testcase_09 AC 291 ms
95,560 KB
testcase_10 AC 284 ms
95,108 KB
testcase_11 AC 569 ms
144,624 KB
testcase_12 AC 562 ms
144,564 KB
testcase_13 AC 434 ms
125,656 KB
testcase_14 AC 432 ms
126,000 KB
testcase_15 AC 410 ms
120,508 KB
testcase_16 AC 416 ms
120,556 KB
testcase_17 AC 596 ms
139,632 KB
testcase_18 AC 597 ms
139,436 KB
testcase_19 AC 545 ms
135,492 KB
testcase_20 AC 536 ms
135,384 KB
testcase_21 AC 568 ms
142,312 KB
testcase_22 AC 560 ms
143,132 KB
testcase_23 AC 446 ms
129,852 KB
testcase_24 AC 434 ms
129,112 KB
testcase_25 AC 242 ms
87,576 KB
testcase_26 AC 250 ms
87,388 KB
testcase_27 AC 388 ms
108,992 KB
testcase_28 AC 350 ms
109,724 KB
testcase_29 AC 386 ms
117,324 KB
testcase_30 AC 384 ms
117,656 KB
testcase_31 AC 432 ms
123,852 KB
testcase_32 AC 432 ms
123,588 KB
testcase_33 AC 380 ms
118,172 KB
testcase_34 AC 383 ms
117,816 KB
testcase_35 AC 426 ms
120,336 KB
testcase_36 AC 432 ms
120,072 KB
testcase_37 AC 273 ms
88,256 KB
testcase_38 AC 264 ms
88,504 KB
testcase_39 AC 258 ms
85,460 KB
testcase_40 AC 256 ms
85,376 KB
testcase_41 AC 291 ms
95,068 KB
testcase_42 AC 292 ms
95,144 KB
testcase_43 AC 277 ms
92,500 KB
testcase_44 AC 600 ms
140,108 KB
testcase_45 AC 386 ms
117,012 KB
testcase_46 AC 262 ms
90,960 KB
testcase_47 AC 482 ms
134,768 KB
testcase_48 AC 453 ms
131,348 KB
testcase_49 AC 462 ms
134,916 KB
testcase_50 AC 409 ms
120,112 KB
testcase_51 AC 221 ms
83,892 KB
testcase_52 AC 534 ms
134,108 KB
testcase_53 AC 588 ms
142,468 KB
testcase_54 AC 608 ms
141,932 KB
testcase_55 AC 597 ms
141,816 KB
testcase_56 AC 613 ms
141,596 KB
testcase_57 AC 615 ms
142,240 KB
testcase_58 AC 611 ms
142,068 KB
testcase_59 AC 594 ms
141,636 KB
testcase_60 AC 596 ms
142,296 KB
testcase_61 AC 592 ms
142,240 KB
testcase_62 AC 613 ms
142,444 KB
testcase_63 AC 595 ms
142,396 KB
testcase_64 AC 600 ms
141,696 KB
testcase_65 AC 611 ms
142,448 KB
testcase_66 AC 594 ms
142,312 KB
testcase_67 AC 651 ms
141,892 KB
testcase_68 AC 612 ms
141,872 KB
testcase_69 AC 577 ms
141,572 KB
testcase_70 AC 590 ms
142,080 KB
testcase_71 AC 578 ms
141,192 KB
testcase_72 AC 634 ms
141,704 KB
testcase_73 AC 625 ms
142,332 KB
testcase_74 AC 683 ms
142,060 KB
testcase_75 AC 637 ms
142,180 KB
testcase_76 AC 616 ms
143,112 KB
testcase_77 AC 607 ms
141,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read=sys.stdin.buffer.read;readline=sys.stdin.buffer.readline;input=lambda:sys.stdin.readline().rstrip()
import bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range;R=range
def I():return int(input())
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def NLI(n):return [[int(i) for i in input().split()] for i in range(n)]
def NLI_(n):return [[int(i)-1 for i in input().split()] for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RLI(n=8,a=1,b=10):return [random.randint(a,b)for i in range(n)]
def RI(a=1,b=10):return random.randint(a,b)
def INP():
    N=9
    n=random.randint(1,N)
    A=[random.randint(1,n) for i in range(m)]
    return n,A
def Rtest(T):
    case,err=0,0
    for i in range(T):
        inp=INP()
        a1=naive(*inp)
        a2=solve(*inp)
        if a1!=a2:
            print(inp)
            print('naive',a1)
            print('solve',a2)
            err+=1
        case+=1
    print('Tested',case,'case with',err,'errors')
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in range(V)]
    FromStdin=True if ls==None else False
    for i in range(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:a,b=inp;c=1
        else:a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
    #h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in R(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in R(base**n):s=[tb//(base**bt)%base for bt in R(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def YN(x):print(['NO','YES'][x])
def Yn(x):print(['No','Yes'][x])
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

mo=10**9+7
#mo=998244353
inf=1<<63
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
alp=[chr(ord('a')+i)for i in range(26)]
sys.setrecursionlimit(10**7)

show_flg=False
show_flg=True

ans=0


n,k,m=map(int,input().split())
x=[]
for i in range(4):
    x+=sorted(LI())

for i in range(n):
    d=max(x[i::n])-min(x[i::n])
    ans+=pow(d,k,m)
    ans%=m
print(ans)
0