結果
問題 | No.2153 何コーダーが何人? |
ユーザー | bayashi-cl |
提出日時 | 2022-12-09 21:25:40 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
11,508 KB |
testcase_01 | AC | 35 ms
11,264 KB |
testcase_02 | AC | 35 ms
11,508 KB |
testcase_03 | AC | 34 ms
11,520 KB |
testcase_04 | AC | 35 ms
11,648 KB |
testcase_05 | AC | 34 ms
11,648 KB |
testcase_06 | AC | 37 ms
11,520 KB |
testcase_07 | AC | 35 ms
11,640 KB |
testcase_08 | AC | 34 ms
11,392 KB |
testcase_09 | AC | 34 ms
11,508 KB |
testcase_10 | AC | 34 ms
11,636 KB |
testcase_11 | AC | 34 ms
11,636 KB |
testcase_12 | AC | 34 ms
11,520 KB |
testcase_13 | AC | 33 ms
11,392 KB |
testcase_14 | AC | 36 ms
11,648 KB |
testcase_15 | AC | 35 ms
11,636 KB |
testcase_16 | AC | 36 ms
11,764 KB |
testcase_17 | AC | 34 ms
11,508 KB |
testcase_18 | AC | 34 ms
11,636 KB |
testcase_19 | AC | 33 ms
11,392 KB |
testcase_20 | AC | 35 ms
11,520 KB |
ソースコード
import os import sys from importlib.machinery import ModuleSpec, SourceFileLoader class BundleImporter(SourceFileLoader): """Importer that supports importing from strings in code. This class is automatically generated by expander. """ module_ispkg = dict() module_code = dict() @classmethod def add_module(cls, fullname, is_package, code): cls.module_ispkg[fullname] = is_package cls.module_code[cls.get_filename(fullname)] = bytes(code, encoding="utf-8") @classmethod def 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 @classmethod def 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 OSError def 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-cl github repository: https://github.com/bayashi-cl/byslib-python This 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 setup import sys from typing import Callable from .fastio import readable def procon_setup(main: Callable[..., None]) -> Callable[..., None]: \"""setup Notes ----- * 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, ) raise if readable(): print("🔺 Unused inputs.", file=sys.stderr) return wrapper """, ) BundleImporter.add_module( fullname="byslib.core.fastio", is_package=False, code="""\ # @title Fast I/O import io import os import sys from typing import Union if "USER" in os.environ: import inspect stdin = sys.stdin.buffer def debug(*args, sep: str = " ") -> None: line = inspect.getouterframes(inspect.currentframe())[1].lineno header = 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: pass readline = stdin.readline def readable() -> bool: return len(stdin.read()) != 0 def 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 Const import sys MOD: int = 998244353 MOD7: int = 1000000007 INF: float = float("Inf") IINF: int = sys.maxsize // 2 """, ) sys.meta_path.append(BundleImporter) from collections import Counter from byslib.core.config import procon_setup from byslib.core.const import IINF, MOD from byslib.core.fastio import debug, int1, readline, sinput @procon_setup def 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 # -----------------------------------------------------------------------------