結果

問題 No.2460 #強調#
ユーザー mattu34mattu34
提出日時 2023-09-08 21:21:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 1,605 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 71,796 KB
最終ジャッジ日時 2023-09-08 21:21:49
合計ジャッジ時間 2,466 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
71,428 KB
testcase_01 AC 93 ms
71,676 KB
testcase_02 AC 93 ms
71,676 KB
testcase_03 AC 93 ms
71,680 KB
testcase_04 AC 94 ms
71,740 KB
testcase_05 AC 94 ms
71,232 KB
testcase_06 AC 93 ms
71,796 KB
testcase_07 AC 91 ms
71,376 KB
testcase_08 AC 93 ms
71,680 KB
testcase_09 AC 92 ms
71,252 KB
testcase_10 AC 93 ms
71,680 KB
testcase_11 AC 94 ms
71,520 KB
testcase_12 AC 94 ms
71,736 KB
testcase_13 AC 93 ms
71,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
import heapq
import bisect
import itertools


class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):  # 多用すると重い
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        group_members = defaultdict(list)
        for member in range(self.n):
            group_members[self.find(member)].append(member)
        return group_members

    def __str__(self):
        return "\n".join(f"{r}: {m}" for r, m in self.all_group_members().items())


dxdy = ((0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1))
INF = float("inf")
MOD = 998244353
mod = 998244353

S = input()
L = S.index("#")
for i in range(L + 1, len(S)):
    if S[i] == "#":
        print(S[L + 1 : i])
        exit()
0