結果

問題 No.1470 Mex Sum
ユーザー Aurora
提出日時 2021-04-10 18:55:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 1,581 ms
コンパイル使用メモリ 167,000 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 07:47:42
合計ジャッジ時間 5,459 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other WA * 49
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
    long long int N,ans=0;
    cin >> N;
    vector<int> cnt(3,0);
    for(int i=0;i<N;i++){
        int A;
        cin >> A;
        if(A == 1) cnt[0]++;
        if(A == 2) cnt[1]++;
        if(A >= 3) cnt[2]++;
    }
    ans += cnt[0]*(cnt[0]-1);
    ans += 3*cnt[0]*cnt[1];
    ans += 2*cnt[0]*cnt[2];
    ans += (N-cnt[0])*(N-cnt[0]-1);
    cout << ans << endl;
}
0