提出 #48625194


ソースコード 拡げる

#include <iostream>
#include <map>
#include <algorithm>

using namespace std;

unsigned long long nc2(unsigned long long n)
{
  return (n * (n - 1)) / 2;
}

int main()
{
  unsigned int n;
  cin >> n;

  map<string, unsigned long long> s_cnt;
  for (unsigned int i = 0; i < n; i++)
  {
    string s;
    cin >> s;

    sort(s.begin(), s.end());
    s_cnt[s]++;
  }

  unsigned long long ans = 0;

  auto iter = s_cnt.begin();
  while (iter != s_cnt.end())
  {
    ans += nc2(iter->second);
    iter++;
  }

  cout << ans << endl;
  return 0;
}

提出情報

提出日時
問題 C - Green Bin
ユーザ michimani
言語 C++ 20 (Clang 16.0.6)
得点 300
コード長 579 Byte
結果 AC
実行時間 81 ms
メモリ 11300 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 13
セット名 テストケース
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
ケース名 結果 実行時間 メモリ
a01 AC 1 ms 3508 KiB
a02 AC 1 ms 3508 KiB
a03 AC 1 ms 3512 KiB
b04 AC 1 ms 3492 KiB
b05 AC 46 ms 4644 KiB
b06 AC 47 ms 4780 KiB
b07 AC 37 ms 3644 KiB
b08 AC 81 ms 11300 KiB
b09 AC 81 ms 11212 KiB
b10 AC 80 ms 11260 KiB
b11 AC 30 ms 3448 KiB
b12 AC 67 ms 8772 KiB
b13 AC 1 ms 3480 KiB