結果
| 問題 | No.1470 Mex Sum |
| コンテスト | |
| ユーザー |
sou1649
|
| 提出日時 | 2021-04-09 22:43:28 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 333 bytes |
| 記録 | |
| コンパイル時間 | 1,401 ms |
| コンパイル使用メモリ | 209,080 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-19 15:18:54 |
| 合計ジャッジ時間 | 3,672 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
sou1649