結果
問題 | No.2201 p@$$w0rd |
ユーザー | tipstar0125 |
提出日時 | 2023-02-23 15:50:24 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 4,062 bytes |
コンパイル時間 | 409 ms |
コンパイル使用メモリ | 13,312 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-07-23 11:10:38 |
合計ジャッジ時間 | 2,157 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
12,416 KB |
testcase_01 | AC | 40 ms
12,416 KB |
testcase_02 | AC | 40 ms
12,416 KB |
testcase_03 | AC | 41 ms
12,416 KB |
testcase_04 | WA | - |
testcase_05 | AC | 40 ms
12,288 KB |
testcase_06 | WA | - |
testcase_07 | AC | 39 ms
12,416 KB |
testcase_08 | AC | 40 ms
12,416 KB |
testcase_09 | AC | 39 ms
12,416 KB |
testcase_10 | AC | 40 ms
12,288 KB |
testcase_11 | AC | 40 ms
12,288 KB |
testcase_12 | AC | 41 ms
12,416 KB |
testcase_13 | AC | 39 ms
12,288 KB |
testcase_14 | AC | 40 ms
12,288 KB |
testcase_15 | AC | 39 ms
12,288 KB |
testcase_16 | WA | - |
testcase_17 | AC | 39 ms
12,416 KB |
testcase_18 | AC | 39 ms
12,288 KB |
testcase_19 | AC | 40 ms
12,416 KB |
testcase_20 | AC | 40 ms
12,288 KB |
testcase_21 | AC | 41 ms
12,416 KB |
testcase_22 | AC | 40 ms
12,288 KB |
testcase_23 | AC | 41 ms
12,288 KB |
ソースコード
from __future__ import annotations import array import bisect import fractions import heapq import itertools import math import random import re import string import sys import time from collections import defaultdict, deque from functools import lru_cache sys.setrecursionlimit(10**6) INF = 10**20 MOD = 10**9 + 7 def read_int_list(): return list(map(int, input().split())) def read_int(): return int(input()) def read_str_list(): return list(input().split()) def read_str(): return input() def is_prime(n: int) -> bool: if n < 2: return False i = 2 ok = True while i * i <= n: if n % i == 0: ok = False i += 1 return ok def eratosthenes(n: int) -> list[bool]: is_prime_list = ([False, True] * (n // 2 + 1))[0 : n + 1] is_prime_list[1] = False is_prime_list[2] = True for i in range(3, n + 1, 2): if not (is_prime_list[i]): continue if i * i > n: break for k in range(i * i, n + 1, i): is_prime_list[k] = False return is_prime_list def legendre(n: int, p: int) -> int: cnt = 0 pp = p while pp <= n: cnt += n // pp pp *= p return cnt def prime_factorize(n: int) -> defaultdict[int, int]: nn = n i = 2 d: defaultdict[int, int] = defaultdict(int) while i * i <= n: while nn % i == 0: d[i] += 1 nn //= i i += 1 if nn != 1: d[nn] += 1 return d def make_divisors(n: int) -> list[int]: i = 1 ret = [] while i * i <= n: if n % i == 0: ret.append(i) if i != n // i: ret.append(n // i) i += 1 ret.sort() return ret def gcd(a: int, b: int) -> int: if a == 0: return b else: return gcd(b % a, a) def lcm(a: int, b: int) -> int: return a * b // gcd(a, b) def align_heap(A: list[int], start: int, end: int): k = start while True: if 2 * k + 2 < end: p = A[k] l = A[2 * k + 1] r = A[2 * k + 2] m = max(p, l, r) if m == p: break elif m == l: A[k], A[2 * k + 1] = A[2 * k + 1], A[k] k = 2 * k + 1 else: A[k], A[2 * k + 2] = A[2 * k + 2], A[k] k = 2 * k + 2 elif 2 * k + 1 < end: p = A[k] l = A[2 * k + 1] m = max(p, l) if m == p: break else: A[k], A[2 * k + 1] = A[2 * k + 1], A[k] k = 2 * k + 1 else: break def build_heap(A: list[int]): N = len(A) for x in range(N // 2 - 1, -1, -1): align_heap(A, x, N) def heap_sort(A: list[int], M: int): build_heap(A) N = len(A) for i in range(N - 1, 0, -1): A[0], A[i] = A[i], A[0] align_heap(A, 0, i) if i == M: print(*A) print(*A) @lru_cache def f(x: int) -> int: if x == 0: return 0 elif x == 1: return 1 return f(x - 1) + f(x - 2) def dfs(pos: int, G: list[list[int]], visited: list[bool], is_chosen: list[bool]): ok = True for nxt in G[pos]: if not visited[nxt]: visited[nxt] = True dfs(nxt, G, visited, is_chosen) ok &= not is_chosen[nxt] is_chosen[pos] = ok def solve(): S = read_str() cnt1 = 0 cnt2 = 0 for s in S: if s == "l" or s == "o": cnt1 += 1 if s == "a" or s == "s": cnt2 += 1 num1 = 0 for i in range(1, cnt1 + 1): num1 += len(list(itertools.combinations(range(cnt1), i))) num2 = 0 for i in range(1, cnt2 + 1): num2 += len(list(itertools.combinations(range(cnt2), i))) if len(S) == cnt1 + cnt2: print(num1 * num2 - 1) else: print(num1 * num2) def main(): solve() # t = read_int() # for _ in range(t): # solve() main()