Submission #13287660


Source Code Expand

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

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for ( int i = 0; i < N; ++i){
        string T;
        cin >> T;
        sort(T.begin(),T.end());
        S.at(i) = T;
    }
    
    sort(S.begin(),S.end());
    
    int ans = 0;
    int counter = 1;
    for ( int 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 0
Code Size 692 Byte
Status WA
Exec Time 132 ms
Memory 5760 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 12
WA × 1
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 119 ms 5760 KB
b06 AC 122 ms 5760 KB
b07 AC 120 ms 5760 KB
b08 AC 131 ms 5760 KB
b09 AC 132 ms 5760 KB
b10 AC 132 ms 5760 KB
b11 WA 108 ms 5760 KB
b12 AC 125 ms 5760 KB
b13 AC 2 ms 256 KB