Cod sursa(job #3200112)

Utilizator Mihai_OctMihai Octavian Mihai_Oct Data 3 februarie 2024 15:55:42
Problema Restante Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.51 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("restante.in");
ofstream fout("restante.out");
unordered_map<string, pair<bool, bool>> fr;
string s;
int n, r;

int main() {
    fin >> n;
    while(n--) {
        fin >> s;
        sort(s.begin(), s.end());
        if(fr.find(s) == fr.end()) {
            fr[s] = {true, true};
            r++;
        }
        else if(!fr[s].second) {
            fr[s].second = true;
            r--;
        }
    }
    fout << r;

    return 0;
}