16332022-11-30 19:00:56levente19Kvázi-Izogramcpp11Accepted 100/10086ms13180 KiB
#include <bits/stdc++.h>
#define speed ios::sync_with_stdio(0);cin.tie(0)

using namespace std;

vector<int> dbszam(vector<char> vc) {
    vector<int> res;
    for(char c : vc) {
        int temp = 0;
        for(int i = 0; i < vc.size(); i++) {
            if(vc[i] == c) temp++;
        }
        res.push_back(temp);
    }
    return res;
}

bool izog(vector<int> sz) {
    bool res = true;
    for(int i : sz) {
        if(i > 2) {
            res = false;
            break;
        }
    }
    return res;
}

int main() {
    vector<string> m;
    int N;
    int izo = -1;

    cin >> N;

    for(int i = 0; i <= N; i++) {
        string line;
        if(getline(cin, line)) {
            m.push_back(line);
        }
    }

    vector<vector<char>> b;
    vector<vector<int>> sz;
    for(string l : m) {
        vector<char> temp;
        for(char c : l) {
            c = tolower(c);
            if(c != ' ' && isalnum(c)) temp.push_back(c);
        }
        b.push_back(temp);
    }

    for(vector<char> vc : b) {
        sz.push_back(dbszam(vc));
    }

    for(vector<int> vi : sz) {
        if(izog(vi)) {
            izo++;
        }
    }

    cout << izo << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1812 KiB
2Accepted2ms2056 KiB
subtask230/30
3Accepted2ms2300 KiB
4Accepted2ms2508 KiB
5Accepted2ms2616 KiB
6Accepted3ms3072 KiB
7Accepted8ms5932 KiB
subtask350/50
8Accepted3ms3112 KiB
9Accepted3ms3188 KiB
10Accepted3ms3460 KiB
11Accepted3ms3664 KiB
12Accepted3ms3528 KiB
13Accepted3ms3724 KiB
subtask420/20
14Accepted6ms4168 KiB
15Accepted9ms4604 KiB
16Accepted18ms5716 KiB
17Accepted35ms7500 KiB
18Accepted61ms10248 KiB
19Accepted78ms12040 KiB
20Accepted86ms13180 KiB