結果
問題 | No.582 キャンディー・ボックス3 |
ユーザー |
|
提出日時 | 2020-04-15 22:49:26 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 669 bytes |
コンパイル時間 | 884 ms |
コンパイル使用メモリ | 80,168 KB |
最終ジャッジ日時 | 2025-01-09 19:21:10 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include <algorithm> #include <numeric> #include <vector> using lint = long long; void solve() { int n; std::cin >> n; std::vector<lint> xs(n); for (auto& x : xs) std::cin >> x; lint sum = std::accumulate(xs.begin(), xs.end(), 0LL); if (sum == 0) { std::cout << "B" << std::endl; return; } std::sort(xs.rbegin(), xs.rend()); --xs.front(); std::sort(xs.rbegin(), xs.rend()); --sum; std::cout << (xs.front() > 1 || sum % 2 != 0 ? "B" : "A") << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }