結果
問題 |
No.2276 I Want AC
|
ユーザー |
|
提出日時 | 2024-01-08 18:24:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 572 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 66,964 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-27 19:38:50 |
合計ジャッジ時間 | 3,506 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 13 WA * 43 |
ソースコード
#include <iostream> #include <string> #include <algorithm> int main() { std::string S; std::cin >> S; // Read the length (unused) std::cin >> S; // Read the actual string long long A = 0, C = 0, a = 0, n = 0; char L = 'A'; for (char s : S) { if (s == L) A++; else { C++; n += A; } } long long c = C, m = n; for (char s : S) { if (s < L) n += c - 1 - a; c -= s > L; a += s == L; m = std::max(n, m); } std::cout << m << std::endl; return 0; }