結果
問題 |
No.3179 3 time mod
|
ユーザー |
![]() |
提出日時 | 2025-06-13 22:02:40 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 644 bytes |
コンパイル時間 | 249 ms |
コンパイル使用メモリ | 82,704 KB |
実行使用メモリ | 56,160 KB |
最終ジャッジ日時 | 2025-06-13 22:03:00 |
合計ジャッジ時間 | 4,131 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | TLE * 1 -- * 40 |
ソースコード
from heapq import heappush, heappop from collections import Counter N = int(input()) P, Q, R = map(int, input().split()) A, B, C = map(int, input().split()) def calc(): freq = Counter() q = [] heappush(q, (A, P)) heappush(q, (B, Q)) heappush(q, (C, R)) res = [] while q: m, x = heappop(q) freq[m] += 1 if freq[m] == 3: res.append(m) if len(res) == 2: d = res[1] - res[0] cnt = (N-res[0]) // d # print(f'{cnt=} {d=}') return cnt+1 heappush(q, (m+x, x)) return 0 ans = calc() print(ans)