Submission #1332225

#TimeUsernameProblemLanguageResultExecution timeMemory
1332225JuanJLRima (COCI25_rima)C++20
15 / 50
2 ms836 KiB
#include <bits/stdc++.h>

#define fst first
#define snd second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
#define forn(i,a,b) for(int i=a; i<b; i++)
#define mset(a,v) memset(a,v,sizeof(a))

using namespace std;
typedef long long ll;

const int MAXN = 1000;

ll n,m,k;
vector<string> line[MAXN];

//types
//aabb
//abab
//abba

vector<ll> atype[5];
vector<ll> btype[5];

int main(){

    atype[0]={0,1}; btype[0]={2,3};
    atype[1]={0,2}; btype[1]={1,3};
    atype[2]={0,3}; btype[2]={1,2};

    cin>>n>>m>>k;
    forn(i,0,n){
        string aux = "";
        forn(j,0,m) cin>>aux, line[i].pb(aux);
    }

    vector<ll> res(3,0);
    string aux;
    forn(i,0,n) if(i%4==0){
        forn(t,0,3){
            set<string> seta;
            set<string> setb;
            for(auto j:atype[t]){
                aux=line[i+j].back(); 
                reverse(ALL(aux));
                while(SZ(aux)>k) aux.pop_back();
                if(SZ(aux)==k) seta.insert(aux);
            }
            for(auto j:btype[t]){
                aux=line[i+j].back(); 
                reverse(ALL(aux));
                while(SZ(aux)>k) aux.pop_back();
                if(SZ(aux)==k) setb.insert(aux);
            }

            if(SZ(seta)==1 && SZ(setb)==1){
                res[t]++;
            }
        }
    }   

    for(auto i:res) cout<<i<<" "; cout<<'\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...