結果

問題 No.2017 Mod7 Parade
ユーザー siganaisiganai
提出日時 2022-07-22 21:55:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 681 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 94,544 KB
最終ジャッジ日時 2023-09-17 09:50:39
合計ジャッジ時間 6,266 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
78,664 KB
testcase_01 AC 145 ms
79,008 KB
testcase_02 AC 141 ms
79,028 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 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 140 ms
78,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env PyPy3

from collections import Counter, defaultdict, deque
import itertools
import re
import math
from functools import reduce
import operator
import bisect
from heapq import *
import functools
mod=10 ** 9 + 7

import sys
input=sys.stdin.readline

k = int(input())
li = [0,1,4,6,5,2]
dp = [[0] * 7 for _ in range(k+1)]
ans = 0
for i in range(k):
    d,l = map(int,input().split())
    p10 = pow(10,l,7)
    xx = li[l % 6] * d % 7
    dp[i+1][xx] += 1
    for j in range(7):
        dp[i+1][(j * p10 + xx) % 7] += dp[i][j]
        dp[i+1][(j * p10 + xx) % 7] %= mod
    for j in range(7):
        ans += dp[i+1][j] * j % mod
        dp[i+1][j] += dp[i][j]

print(ans)
0