結果
| 問題 |
No.1470 Mex Sum
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2021-04-09 22:34:35 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 355 bytes |
| コンパイル時間 | 2,053 ms |
| コンパイル使用メモリ | 194,628 KB |
| 最終ジャッジ日時 | 2025-01-20 14:50:37 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 49 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr), ios::sync_with_stdio(false);
int N, a;
cin >> N;
vector<long long> n(3);
for (int i = 0; i < N; i++) {
cin >> a, a--;
n[min(a, 2)]++;
}
cout << n[0] * (n[0] - 1) / 2 + n[0] * n[1] * 2 + n[0] * n[2] + 1LL * N * (N - 1) / 2 << '\n';
}
hitonanode