結果
| 問題 | No.582 キャンディー・ボックス3 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-09-08 17:10:23 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 811 bytes | 
| コンパイル時間 | 2,016 ms | 
| コンパイル使用メモリ | 208,500 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-09-08 17:10:27 | 
| 合計ジャッジ時間 | 3,319 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 11 WA * 5 RE * 1 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<int> v;
    int n,x;
    long long int sum = 0;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        cin >> x;
        if (x > 0) v.push_back(x);
        sum += x;
    }
    sort(v.begin(), v.end());
    if (sum == 0)
    {
        cout << "B" << '\n';
    }
    if (v.back() == 1) 
    {
        if (sum % 2 == 0) 
        {
            cout << "B" << '\n';
        }
        else
        {
            cout << "A" << '\n';
        }
    }
    map<int, int> cnt;
    for(auto x : v) cnt[x] += 1;
    if (cnt[2] == 1 && v.size() == (cnt[1] + cnt[2]) && cnt[1] % 2 == 1) 
    {
        cout << "A" << '\n';
    }
    else
    {
        cout << "B" << '\n';
    }
    return 0;   
}
            
            
            
        