結果
問題 |
No.1470 Mex Sum
|
ユーザー |
![]() |
提出日時 | 2021-04-09 22:43:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 333 bytes |
コンパイル時間 | 2,880 ms |
コンパイル使用メモリ | 191,304 KB |
最終ジャッジ日時 | 2025-01-20 14:57:45 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 14 WA * 35 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define ll long long int main(){ ll n; cin>>n; ll x=0,y=0; for(ll i=0;i<n;i++){ int a; cin>>a; if(a==1) x++; else if(a==2) 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; }