結果
問題 | No.2276 I Want AC |
ユーザー |
|
提出日時 | 2024-01-08 18:25:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 663 bytes |
コンパイル時間 | 716 ms |
コンパイル使用メモリ | 64,552 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-27 19:38:57 |
合計ジャッジ時間 | 2,377 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 2 WA * 54 |
ソースコード
#include <iostream> #include <string> int main() { long long A = 0, C = 0, a = 0, n = 0; char L = 'A'; std::string S; std::cin >> S; // Assuming the first input is not used as per the Python code for (char s : S) { if (s == L) { A += 1; } else { C += 1; n += A; } } long long c = C; long long m = n; for (char s : S) { if (s < L) { n += c - 1 - a; a += 1; c -= 1; } c -= s > L; a += s == L; m = std::max(n, m); } std::cout << m << std::endl; return 0; }