/ SeriousOJ /

Record Detail

Compile Error

foo.cc:40:10: fatal error: algo/debug.h: No such file or directory
   40 | #include "algo/debug.h"
      |          ^~~~~~~~~~~~~~
compilation terminated.

Code

/*
 * Author: Md. Mahfuzur Rahman
 * Purpose: Competitive Programming
 */

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define endl '\n'
#define nl cout << endl
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define srt(v) sort(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<long,long>
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define minheap priority_queue<long long, vector<long long>, greater<long long>>
#define maxheap priority_queue<long long, vector<long long>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key
template <typename... T>
void read(T&... args){((cin>>args), ...);}
template <typename... T>
void write(T... args){((cout<<args<<" "), ...);}

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const int MAX = 1e6;

#ifdef ONLINE_JUDGE
#define debug(...) 42
#else
#include "algo/debug.h"
#endif

void solve(int tc)
{
    ll n,m;cin>>n>>m;
    vector<string>v(n);
    for(auto &x:v)cin>>x;
    string s1="",s2="";
    for(ll j=0;j<m;j++)
    {
        map<char,ll>tm;
    for(ll i=0;i<n-1;i++){
        tm[v[i][j]]++;
    }
        ll ct=0;char c;
        for(auto x:tm)
        {
            if(ct<x.second){
                c=x.first;
                ct=x.second;
            }
        }
        s1+=c;
    }
    for(ll j=0;j<m;j++)
    {
        map<char,ll>tm;
    for(ll i=n-1;i<n;i++){
        tm[v[i][j]]++;
    }
        ll ct=0;char c;
        for(auto x:tm)
        {
            if(ct<x.second){
                c=x.first;
                ct=x.second;
            }
        }
        s2+=c;
    }
    ll cur=0,tot=0;
    // debug(s1);debug(s2);
    for(ll i=0;i<n-1;i++)
    {
        cur=0;
        for(ll j=0;j<m;j++){
            if(s1[j]==v[i][j])cur++;
        }
        tot+=cur;
    }
    for(ll i=n-1;i<n;i++)
    {
        cur=0;
        for(ll j=0;j<m;j++){
            if(s2[j]==v[i][j])cur++;
        }
        tot+=cur;
    }
    cout<<tot<<endl;
}

int main()
{
    FAST_IO;
    int t = 1;
    int tc=1;
    cin >> t;
    while (t--)
    {
        solve(tc++);
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1164 Simple character matching game
Contest
Brain Booster #8
Language
C++17 (G++ 13.2.0)
Submit At
2025-02-17 15:35:30
Judged At
2025-02-17 15:35:30
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes