結果
問題 | No.2153 何コーダーが何人? |
ユーザー |
|
提出日時 | 2022-12-09 21:25:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 4,588 bytes |
コンパイル時間 | 94 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,764 KB |
最終ジャッジ日時 | 2024-10-14 19:33:40 |
合計ジャッジ時間 | 1,703 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
import osimport sysfrom importlib.machinery import ModuleSpec, SourceFileLoaderclass BundleImporter(SourceFileLoader):"""Importer that supports importing from strings in code.This class is automatically generated by expander."""module_ispkg = dict()module_code = dict()@classmethoddef add_module(cls, fullname, is_package, code):cls.module_ispkg[fullname] = is_packagecls.module_code[cls.get_filename(fullname)] = bytes(code, encoding="utf-8")@classmethoddef find_spec(cls, fullname, path=None, target=None):if fullname in cls.module_ispkg:return ModuleSpec(fullname,cls(fullname, ""),is_package=cls.module_ispkg[fullname],)else:return None@classmethoddef get_filename(cls, fullname):return fullname.replace(".", "_") + ".py"def get_data(self, path):try:return super().get_data(path)except OSError:try:return self.module_code[path]except KeyError:raise OSErrordef path_stats(self, path):return {"mtime": os.stat(__file__).st_mtime, "size": None}BundleImporter.add_module(fullname="byslib",is_package=True,code="""\\"""procon library by bayashi-clgithub repository: https://github.com/bayashi-cl/byslib-pythonThis library can be expanded with expander.- https://github.com/bayashi-cl/expander\"""__version__ = "0.1.0"""",)BundleImporter.add_module(fullname="byslib.core",is_package=True,code="""\# @title Core Featule""",)BundleImporter.add_module(fullname="byslib.core.config",is_package=False,code="""\# @title setupimport sysfrom typing import Callablefrom .fastio import readabledef procon_setup(main: Callable[..., None]) -> Callable[..., None]:\"""setupNotes-----* Set recursionlimit to 1e7* Repeat main function for testcases* If exception raised, indicate in which test case it was raised.\"""def wrapper(case: int = 1) -> None:sys.setrecursionlimit(10**7)for i in range(case):try:main(case=i + 1)except Exception as e:print(f"❌ {type(e).__name__} raised in tastcase {i + 1}.",file=sys.stderr,)raiseif readable():print("🔺 Unused inputs.", file=sys.stderr)return wrapper""",)BundleImporter.add_module(fullname="byslib.core.fastio",is_package=False,code="""\# @title Fast I/Oimport ioimport osimport sysfrom typing import Unionif "USER" in os.environ:import inspectstdin = sys.stdin.bufferdef debug(*args, sep: str = " ") -> None:line = inspect.getouterframes(inspect.currentframe())[1].linenoheader = f"📌 line{line:>4}: "space = "\\n" + " " * (len(header) + 1)out = header + sep.join(map(str, args)).replace("\\n", space)print(out, file=sys.stderr)else:stdin = io.BytesIO(os.read(0, os.fstat(0).st_size))def debug(*args, sep: str = " ") -> None:passreadline = stdin.readlinedef readable() -> bool:return len(stdin.read()) != 0def sinput() -> str:return readline().decode().rstrip()def int1(s: Union[str, bytes]) -> int:return int(s) - 1""",)BundleImporter.add_module(fullname="byslib.core.const",is_package=False,code="""\# @title Constimport sysMOD: int = 998244353MOD7: int = 1000000007INF: float = float("Inf")IINF: int = sys.maxsize // 2""",)sys.meta_path.append(BundleImporter)from collections import Counterfrom byslib.core.config import procon_setupfrom byslib.core.const import IINF, MODfrom byslib.core.fastio import debug, int1, readline, sinput@procon_setupdef main(**kwargs) -> None:n = int(readline())d = dict()for _ in range(n):s, c = sinput().split()d[s] = int(c)cnt = Counter(d.values())for i in range(8):print(cnt[i])if __name__ == "__main__":t = 1 # * int(readline())main(t)# package infomations# -----------------------------------------------------------------------------# byslib-python# Version : 0.1.0# Author : bayashi-cl# Home-page: https://bayashi-cl.github.io/byslib-python/# License : CC0# -----------------------------------------------------------------------------