Submission #6808875


Source Code Expand

Copy
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

template <typename T> T id(T b) {return b;};
template <class It> bool all(It f,It l){return std::all_of(f,l,id<bool>);}
template <class It> bool any(It f,It l){return std::any_of(f,l,id<bool>);}
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }

const int MAX_N = 100000;
int n;
string s;

int main()
{
  cin >> n;
  map<string,ll> cnt;
  forn(i,n) {
    cin >> s;
    sort(s.begin(),s.end());
    cnt[s]++;
  }

  ll res = 0;
  for (auto p : cnt) {
    res += p.snd*(p.snd-1)/2;
  }

  cout << res << endl;

  return 0;
}

Submission Info

Submission Time
Task C - Green Bin
User sash0
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1200 Byte
Status AC
Exec Time 144 ms
Memory 11136 KB

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 256 KB
a02 AC 1 ms 256 KB
a03 AC 1 ms 256 KB
b04 AC 1 ms 256 KB
b05 AC 81 ms 1920 KB
b06 AC 84 ms 1920 KB
b07 AC 65 ms 256 KB
b08 AC 144 ms 11136 KB
b09 AC 140 ms 11008 KB
b10 AC 138 ms 11136 KB
b11 AC 57 ms 256 KB
b12 AC 114 ms 7680 KB
b13 AC 2 ms 384 KB