Submission #19558382


Source Code Expand

Copy
#include <algorithm>
#include <array>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
#define int long long
int N;
vector<string> s;
string tmp;
int tmp_n, ans;
signed main()
{
    cin >> N;
    s.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> s.at(i);
        sort(s.at(i).begin(), s.at(i).end());
    }
    sort(s.begin(), s.end());
    tmp = s.at(0);
    for (int i = 1; i < N; i++) {
        if (tmp == s.at(i)) {
            tmp_n++;
        } else {
            ans += (tmp_n * (tmp_n + 1)) / 2;
            tmp_n = 0;
            tmp = s.at(i);
        }
    }
    ans += (tmp_n * (tmp_n + 1)) / 2;
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Green Bin
User yossi_2000
Language C++ (GCC 9.2.1)
Score 300
Code Size 744 Byte
Status AC
Exec Time 70 ms
Memory 6364 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 7 ms 3576 KB
a02 AC 3 ms 3424 KB
a03 AC 2 ms 3520 KB
b04 AC 2 ms 3596 KB
b05 AC 61 ms 6284 KB
b06 AC 64 ms 6292 KB
b07 AC 61 ms 6332 KB
b08 AC 69 ms 6260 KB
b09 AC 70 ms 6312 KB
b10 AC 69 ms 6364 KB
b11 AC 58 ms 6300 KB
b12 AC 64 ms 6328 KB
b13 AC 3 ms 3508 KB