提出 #70436524


ソースコード 拡げる

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[200005],b[200005],ans;
vector<ll> c;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
		cin>>a[i];
		b[a[i]]++;
	}
	for(int i=1;i<=n;i++){
		if(b[i]>=2)ans+=b[i]*(b[i]-1)/2*(n-b[i]);
	}
	cout<<ans;
    return 0;
}

提出情報

提出日時
問題 C - Odd One Subsequence
ユーザ a_little_cat
言語 C++ 20 (gcc 12.2)
得点 300
コード長 362 Byte
結果 AC
実行時間 14 ms
メモリ 6592 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 28
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3464 KiB
example_01.txt AC 1 ms 3536 KiB
hand_00.txt AC 13 ms 6592 KiB
hand_01.txt AC 10 ms 5000 KiB
hand_02.txt AC 8 ms 5044 KiB
hand_03.txt AC 1 ms 3400 KiB
hand_04.txt AC 1 ms 3420 KiB
hand_05.txt AC 10 ms 4964 KiB
random_00.txt AC 14 ms 6584 KiB
random_01.txt AC 13 ms 6452 KiB
random_02.txt AC 13 ms 6516 KiB
random_03.txt AC 13 ms 6512 KiB
random_04.txt AC 13 ms 6516 KiB
random_05.txt AC 10 ms 5184 KiB
random_06.txt AC 11 ms 5100 KiB
random_07.txt AC 11 ms 5128 KiB
random_08.txt AC 10 ms 5248 KiB
random_09.txt AC 10 ms 5052 KiB
random_10.txt AC 9 ms 5096 KiB
random_11.txt AC 9 ms 4960 KiB
random_12.txt AC 9 ms 5032 KiB
random_13.txt AC 9 ms 5028 KiB
random_14.txt AC 9 ms 5168 KiB
random_15.txt AC 8 ms 4856 KiB
random_16.txt AC 8 ms 5092 KiB
random_17.txt AC 7 ms 4976 KiB
random_18.txt AC 7 ms 5084 KiB
random_19.txt AC 7 ms 5044 KiB