Submission #1366679

#TimeUsernameProblemLanguageResultExecution timeMemory
1366679thanhbinh13Rima (COCI25_rima)C++20
50 / 50
1 ms836 KiB
#include <bits/stdc++.h>
using namespace std;

long long n,m,k;
string a[505][25];
bool check(string x,string y) {
    if (x.length() < k || y.length() < k) return false;
    if (x.substr(x.length()-k,k) == y.substr(y.length()-k,k)) {
        return true;
    }
    return false;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m >> k;
    for(int i = 1; i <= n; i++) {
        for (int j = 1; j <=  m; j++) {
            cin >> a[i][j];
        }
    }
    long long loai1 = 0,loai2 = 0,loai3 = 0;
    for (int i = 1; i <= n; i+=4) {
        if (check(a[i][m],a[i+1][m]) && check(a[i+2][m],a[i+3][m])) loai1++;
        if (check(a[i][m],a[i+2][m]) && check(a[i+1][m],a[i+3][m])) loai2++;
        if (check(a[i][m],a[i+3][m]) && check(a[i+1][m],a[i+2][m])) loai3++;
    }
    cout << loai1 << " " << loai2 << " " << loai3;
}
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...
#Result Execution timeMemoryGrader output
Fetching results...