結果
問題 | No.2276 I Want AC |
ユーザー | Daylight |
提出日時 | 2023-04-21 21:58:27 |
言語 | Nim (2.0.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,195 bytes |
コンパイル時間 | 4,027 ms |
コンパイル使用メモリ | 76,432 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 15:27:43 |
合計ジャッジ時間 | 6,089 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,820 KB |
testcase_01 | AC | 2 ms
6,820 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 1 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,816 KB |
testcase_06 | AC | 1 ms
6,816 KB |
testcase_07 | AC | 2 ms
6,820 KB |
testcase_08 | AC | 1 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,816 KB |
testcase_10 | AC | 2 ms
6,820 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 | 4 ms
6,816 KB |
testcase_36 | AC | 4 ms
6,820 KB |
testcase_37 | AC | 5 ms
6,820 KB |
testcase_38 | AC | 4 ms
6,816 KB |
testcase_39 | AC | 4 ms
6,820 KB |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | AC | 6 ms
6,820 KB |
testcase_45 | WA | - |
testcase_46 | AC | 6 ms
6,816 KB |
testcase_47 | WA | - |
testcase_48 | WA | - |
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 | AC | 4 ms
6,816 KB |
testcase_58 | AC | 5 ms
6,816 KB |
コンパイルメッセージ
/home/judge/data/code/Main.nim(25, 12) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(23, 15) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(15, 12) Warning: imported and not used: 'algorithm' [UnusedImport] /home/judge/data/code/Main.nim(18, 12) Warning: imported and not used: 'lists' [UnusedImport] /home/judge/data/code/Main.nim(21, 12) Warning: imported and not used: 'sequtils' [UnusedImport]
ソースコード
import macros macro Please(x): untyped = nnkStmtList.newTree() Please use Nim-ACL Please use Nim-ACL Please use Nim-ACL #[ include daylight/base ]# when not declared DAYLIGHT_BASE_HPP: const DAYLIGHT_BASE_HPP* = 1 import system import macros import algorithm import tables import sets import lists import intsets import critbits import sequtils import strutils import std/math import strformat import sugar let readToken* = iterator(oneChar: bool = false): string {.closure.}= while true: var line = stdin.readLine.split for s in line: if oneChar: for i in 0..<s.len(): yield s[i..i] else: yield s proc read*(t: typedesc[string]): string = result = readToken() while result == "": result = readToken() proc read*(t: typedesc[int]): int = read(string).parseInt proc read*(t: typedesc[float]): float = read(string).parseFloat proc read*(t: typedesc[char]): char = readToken(true)[0] macro readSeq*(t: typedesc, n: varargs[int]): untyped = var repStr = "" for arg in n: repStr &= &"({arg.repr}).newSeqWith " parseExpr(&"{repStr}read({t})") macro read*(ts: varargs[auto]): untyped= var tupStr = "" for t in ts: tupStr &= &"read({t.repr})," parseExpr(&"({tupStr})") macro readTupleSeq*(n: int, ts:varargs[auto]): untyped= for typ in ts: if typ.typeKind != ntyAnything: error("Expected typedesc, got " & typ.repr, typ) parseExpr(&"({n.repr}).newSeqWith read({ts.repr})") macro initSeq*(t: typedesc, n: varargs[int]): untyped = var repStr = "" for i, arg in n: if i == n.len - 1: repStr &= &"newSeq[{t}]({arg.repr}) " else: repStr &= &"({arg.repr}).newSeqWith " parseExpr(repStr) proc `-`*(a,b: char): int = ord(a) - ord(b) proc `+`*(a: char,b: int): char = char(ord(a) + b) proc `-`*(a: char,b: int): char = char(ord(a) - b) proc `++`*(a: var int) = a += 1 proc `--`*(a: var int) = a += 1 proc chmin*[T](a: var T, b: T): bool {.discardable.} = if a > b: a = b return true return false proc chmax*[T](a: var T, b: T): bool {.discardable.} = if a < b: a = b return true return false const INF* = (1e9+100).int const LINF* = (4e18 + 100).int discard proc solve() = var N = read(int) S = read(string) cntA = 0 cntC = 0 ans = 0 for i in 0..<N: if S[i] == 'A': cntA += 1 else: cntC += 1 ans += cntA var cur = ans cntA = 0 for i in 0..<N: if S[i] == 'A': cntA += 1 elif S[i] == 'C': cntC += 1 else: cntC -= 1 cur += cntC cur -= cntA cntA += 1 ans.chmax(cur) echo ans solve()