結果
問題 | No.2830 Don't Stop the Game |
ユーザー | 👑 rin204 |
提出日時 | 2024-08-02 22:00:33 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 59 ms / 2,000 ms |
コード長 | 1,183 bytes |
コンパイル時間 | 259 ms |
コンパイル使用メモリ | 82,468 KB |
実行使用メモリ | 70,032 KB |
最終ジャッジ日時 | 2024-08-02 22:00:36 |
合計ジャッジ時間 | 3,591 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 54 ms
68,964 KB |
testcase_01 | AC | 53 ms
69,552 KB |
testcase_02 | AC | 53 ms
68,660 KB |
testcase_03 | AC | 55 ms
69,000 KB |
testcase_04 | AC | 54 ms
68,480 KB |
testcase_05 | AC | 52 ms
69,260 KB |
testcase_06 | AC | 54 ms
69,836 KB |
testcase_07 | AC | 59 ms
68,296 KB |
testcase_08 | AC | 54 ms
69,092 KB |
testcase_09 | AC | 55 ms
70,000 KB |
testcase_10 | AC | 54 ms
69,500 KB |
testcase_11 | AC | 54 ms
68,940 KB |
testcase_12 | AC | 53 ms
69,276 KB |
testcase_13 | AC | 57 ms
69,476 KB |
testcase_14 | AC | 55 ms
68,440 KB |
testcase_15 | AC | 54 ms
68,712 KB |
testcase_16 | AC | 54 ms
68,904 KB |
testcase_17 | AC | 55 ms
70,032 KB |
testcase_18 | AC | 54 ms
69,204 KB |
testcase_19 | AC | 53 ms
68,516 KB |
ソースコード
ans = [] for j in range(1, 31): ans.append((1,)) ans.append((j,)) A = [i for i in range(1, 31)] def f(i, j): t = A[i] + A[j] A[i] = A[j] = t i += 1 j += 1 ans.append((3,)) ans.append((i, j)) tot = 998244352 f(29, 29) f(29, 28) f(29, 27) f(29, 1) for _ in range(23): f(29, 29) ans.append((5,)) ans.append((30, 998244352)) f(1, 29) f(27, 29) f(28, 29) for i in range(1, 30): f(i, 29) print(len(ans) // 2) for row in ans: print(*row) exit() import random random.seed(0) MOD = 998244353 n = 30 A = [random.randrange(1, 10**7) for _ in range(n)] B = [0] * n for i in range(len(ans) // 2): t = ans[i * 2][0] if t == 1: j = ans[i * 2 + 1][0] - 1 for k in range(n): B[k] += pow(A[j], k + 1, MOD) B[k] %= MOD elif t == 3: i, j = ans[i * 2 + 1] i -= 1 j -= 1 b = B[i] * B[j] % MOD B[i] = B[j] = b elif t == 5: i, x = ans[i * 2 + 1] i -= 1 B[i] += x B[i] %= MOD print(A) print(B) print(sum(A)) print(sum(B)) print(len(ans) // 2)