結果
| 問題 |
No.1470 Mex Sum
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2021-04-11 15:23:04 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 2,000 ms |
| コード長 | 539 bytes |
| コンパイル時間 | 1,593 ms |
| コンパイル使用メモリ | 168,260 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 10:22:30 |
| 合計ジャッジ時間 | 5,491 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 49 |
ソースコード
/**
* @FileName a.cpp
* @Author kanpurin
* @Created 2021.04.11 15:22:59
**/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
int main() {
int n;cin >> n;
vector<ll> cnt(3,0);
for (int i = 0; i < n; i++) {
int a;cin >> a;
if (a >= 3) cnt[2]++;
else if (a == 2) cnt[1]++;
else cnt[0]++;
}
cout << 2 * cnt[0] * cnt[2] + 2 * cnt[0] * (cnt[0]-1)/2 + 3 * cnt[0] * cnt[1] + cnt[1] * (cnt[1]-1)/2+cnt[1] * cnt[2] + cnt[2] * (cnt[2]-1) / 2 << endl;
return 0;
}
🍮かんプリン