Submission #48625194


Source Code Expand

#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;
}

Submission Info

Submission Time
Task C - Green Bin
User michimani
Language C++ 20 (Clang 16.0.6)
Score 300
Code Size 579 Byte
Status AC
Exec Time 81 ms
Memory 11300 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 13
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13
Case Name Status Exec Time Memory
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