結果
問題 | No.435 占い(Extra) |
ユーザー | titia |
提出日時 | 2023-04-26 01:17:28 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 868 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 346,152 KB |
最終ジャッジ日時 | 2024-04-27 08:56:23 |
合計ジャッジ時間 | 20,466 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 29 ms
17,828 KB |
testcase_01 | AC | 30 ms
10,880 KB |
testcase_02 | AC | 30 ms
10,880 KB |
testcase_03 | AC | 30 ms
10,880 KB |
testcase_04 | AC | 30 ms
11,008 KB |
testcase_05 | AC | 30 ms
10,752 KB |
testcase_06 | AC | 43 ms
11,008 KB |
testcase_07 | AC | 33 ms
10,880 KB |
testcase_08 | AC | 51 ms
11,264 KB |
testcase_09 | AC | 49 ms
11,008 KB |
testcase_10 | AC | 211 ms
14,848 KB |
testcase_11 | AC | 205 ms
11,392 KB |
testcase_12 | AC | 1,835 ms
49,840 KB |
testcase_13 | AC | 1,853 ms
15,480 KB |
testcase_14 | AC | 1,751 ms
11,264 KB |
testcase_15 | AC | 1,699 ms
10,880 KB |
testcase_16 | AC | 1,622 ms
11,008 KB |
testcase_17 | TLE | - |
testcase_18 | AC | 1,812 ms
49,900 KB |
testcase_19 | AC | 1,840 ms
15,604 KB |
testcase_20 | MLE | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
ソースコード
# 3を除けば9の余りを考えて良い。 INV=[0,1,5,0,7,2,0,4,8] T=int(input()) for tests in range(T): n,x,a,b,m=map(int,input().split()) S=[0]*n S[0]=x for i in range(n-1): S[i+1]=((S[i]^a) +b)%m for i in range(n): S[i]%=10 if S==[0]*len(S): print(0) continue ANS=0 TWO=1 THREE=0 for i in range(len(S)): if i==0 or i==len(S)-1: ANS=(ANS+S[i])%9 continue x=i while x%3==0: x//=3 THREE-=1 TWO=TWO*INV[x%9]%9 x=len(S)-i while x%3==0: x//=3 THREE+=1 TWO=TWO*x%9 #print(TWO,THREE) if THREE==0: ANS=(ANS+S[i]*TWO)%9 elif THREE==1: ANS=(ANS+S[i]*TWO*3)%9 if ANS==0: ANS=9 print(ANS)