結果
問題 | No.2276 I Want AC |
ユーザー | kuro_B |
提出日時 | 2023-05-10 15:54:12 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,923 bytes |
コンパイル時間 | 198 ms |
コンパイル使用メモリ | 81,920 KB |
実行使用メモリ | 105,728 KB |
最終ジャッジ日時 | 2024-05-05 03:44:05 |
合計ジャッジ時間 | 16,364 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 119 ms
83,464 KB |
testcase_01 | AC | 121 ms
83,456 KB |
testcase_02 | AC | 118 ms
83,328 KB |
testcase_03 | AC | 120 ms
83,224 KB |
testcase_04 | AC | 117 ms
83,072 KB |
testcase_05 | AC | 114 ms
83,072 KB |
testcase_06 | AC | 113 ms
83,200 KB |
testcase_07 | AC | 110 ms
83,072 KB |
testcase_08 | AC | 110 ms
82,816 KB |
testcase_09 | AC | 110 ms
82,944 KB |
testcase_10 | AC | 111 ms
83,652 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | AC | 142 ms
92,656 KB |
testcase_36 | AC | 142 ms
92,396 KB |
testcase_37 | AC | 314 ms
105,472 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 172 ms
98,304 KB |
testcase_41 | AC | 176 ms
98,432 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 161 ms
99,000 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 178 ms
98,640 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | WA | - |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | AC | 253 ms
98,560 KB |
ソースコード
###スニペット始まり### import sys, re from copy import copy, deepcopy from math import ceil, floor, sqrt,factorial, gcd, pi, degrees, radians, sin, asin, cos, acos, tan, atan2 from collections import Counter, deque, defaultdict from heapq import heapify, heappop, heappush from itertools import permutations, accumulate, product, combinations, combinations_with_replacement from bisect import bisect, bisect_left, bisect_right from functools import reduce, lru_cache from string import ascii_uppercase, ascii_lowercase from decimal import Decimal, ROUND_HALF_UP #四捨五入用 def input(): return sys.stdin.readline().rstrip('\n') #easy-testのpypyでは再帰数を下げる。 if __file__=='prog.py': sys.setrecursionlimit(10**5) else: sys.setrecursionlimit(10**6) def lcm(a, b): return a * b // gcd(a, b) #3つ以上の最大公約数/最小公倍数。Nを要素数、Mを数値の大きさとして、O(NlogM) def gcd_v2(l: list): return reduce(gcd, l) def lcm_v2(l: list): return reduce(lcm, l) #nPk def nPk(n, k): return factorial(n) // factorial(n - k) #逆元 def modinv(a, mod=10**9+7): return pow(a, mod-2, mod) INF = float('inf') MOD = 10 ** 9 + 7 ###スニペット終わり### N=int(input()) S=list(input()) hatena_idx=[] for i, s in enumerate(S): if s=='?': hatena_idx.append(i) max_=-INF def is_ok(mid): global max_ s=S for i, idx in enumerate(hatena_idx): if i<mid: s[idx]='A' else: s[idx]='C' counter=Counter() cnt=0 for i in range(N): if s[-(i+1)]=='A': cnt+=counter['C'] counter[s[-(i+1)]]+=1 max_=max(cnt,max_) return max_==cnt def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok meguru_bisect(len(hatena_idx)+1, -1) print(max_)