結果
| 問題 |
No.1470 Mex Sum
|
| コンテスト | |
| ユーザー |
sou1649
|
| 提出日時 | 2021-04-09 22:20:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 332 bytes |
| コンパイル時間 | 2,649 ms |
| コンパイル使用メモリ | 191,308 KB |
| 最終ジャッジ日時 | 2025-01-20 14:39:31 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 2 WA * 47 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ll n;
cin>>n;
ll x=0,y=0;
for(int i=0;i<n;i++){
int a;
cin>>a;
if(a==0) x++;
else if(a==1) y++;
}
ll ans=0;
ans+=3*x*y;
ans+=x*(x-1);
ans+=n*(n-1)/2-x*y-x*(x-1)/2;
cout<<ans<<endl;
}
sou1649