Submission #13287686


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

int main() {
    int64_t N;
    cin >> N;
    vector<string> S(N);
    for ( int64_t i = 0; i < N; ++i){
        string T;
        cin >> T;
        sort(T.begin(),T.end());
        S.at(i) = T;
    }
    
    sort(S.begin(),S.end());
    
    int64_t ans = 0;
    int64_t counter = 1;
    for ( int64_t i = 0; i < N-1; ++i){
        //cout << counter << ans << endl;
        if ( S.at(i) == S.at(i+1) ){
            counter += 1;
        } else {
            ans = ans + counter * ( counter - 1 )/2;
            counter = 1;
        }
    }
    ans = ans + counter * ( counter - 1 )/2;
    cout << ans << endl;
    
    return 0;
}

Submission Info

Submission Time
Task C - Green Bin
User tehutex
Language C++14 (GCC 5.4.1)
Score 300
Code Size 712 Byte
Status AC
Exec Time 132 ms
Memory 5760 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 117 ms 5760 KB
b06 AC 123 ms 5760 KB
b07 AC 120 ms 5760 KB
b08 AC 131 ms 5760 KB
b09 AC 131 ms 5760 KB
b10 AC 132 ms 5760 KB
b11 AC 108 ms 5760 KB
b12 AC 129 ms 5760 KB
b13 AC 2 ms 256 KB