Submission #1361213

#TimeUsernameProblemLanguageResultExecution timeMemory
1361213islam_2010Rima (COCI25_rima)C++20
50 / 50
1 ms468 KiB
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
 
const int sz = 1e5+5;


signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> v;
    int a = 0, b = 0, c = 0;
    for(int i = 0; i < n; i++){
        string s[m];
        for(int j = 0; j < m; j++){
            cin >> s[j];
        }v.push_back(s[m-1]);
    }
    for(int i = 0; i < n/4; i++){
        bool ok = true;
        int ind = i*4;
        for(int j = ind; j < ind+4; j++){
            if(v[j].size() < k){
                ok = false;
                break;
            }
        }if(!ok){
            continue;
        }
        if(v[ind].substr(v[ind].size() - k) == v[ind+1].substr(v[ind+1].size()-k) && v[ind+2].substr(v[ind+2].size()-k) == v[ind+3].substr(v[ind+3].size()-k)){
            a++;
        }if(v[ind].substr(v[ind].size() - k) == v[ind+2].substr(v[ind+2].size()-k) && v[ind+1].substr(v[ind+1].size()-k) == v[ind+3].substr(v[ind+3].size()-k)){
            b++;
        }if(v[ind].substr(v[ind].size() - k) == v[ind+3].substr(v[ind+3].size()-k) && v[ind+1].substr(v[ind+1].size()-k) == v[ind+2].substr(v[ind+2].size()-k)){
            c++;
        }
    }cout << a << " " << b << " " << c << endl;
    
    return 0;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...