Submission #1292056

#TimeUsernameProblemLanguageResultExecution timeMemory
1292056maxphastBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
112 ms9304 KiB
/*
* @Author: MaxPhast
* @File:   test.cpp
* @Date:   2025-11-18 21:58:58
*/
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define ii pair <int , int>
#define iii pair <int , ii>
#define iiii pair <ii , ii>
#define FOR(i , l , r) for(int i = (l) , _r = (r) ; i <= _r ; ++ i)
#define FORD(i , r , l) for(int i = (r) , _l = (l) ; i >= _l ; -- i)
#define ALL(vec) vec.begin() , vec.end()
#define UNI(vec) sort(ALL(vec)) , vec.erase(unique(ALL(vec)) , vec.end())
#define pb push_back
#define MASK(i) (1ll << i)
#define BIT(mask , i) ((mask >> i) & 1ll)
#define ON(mask , i) (mask | MASK(i))
#define OFF(mask , i) (mask & (~MASK(i)))
#define TURN(mask , i) (mask ^ MASK(i))
#define BP(mask) __builtin_popcountll(mask)
#define sqr(x) (1ll * (x) * (x))
#define fi first
#define se second
#define oo 1e18
#define time() cerr << " \n " << "Time : " << 1000.0 * clock() / CLOCKS_PER_SEC << "ms."
#define IO(TASK) if(fopen(#TASK".INP" , "r")){freopen(#TASK".INP" , "r" , stdin); freopen(#TASK".OUT" , "w" , stdout);}

template <class X , class Y>
    bool maxz(X &a , const Y b)
    {
        if(a < b)
        {
            a = b;
            return true;
        }
        return false;
    }
template <class X , class Y>
    bool minz(X &a , const Y b)
    {
        if(a > b)
        {
            a = b;
            return true;
        }
        return false;
    }

namespace MaxPhast
{

    const int N = 3e3 + 5;

    int n , m , ans;
    char c[N][N];
    int cntO[N] , cntI[N];

    void solve()
    {
        cin >> n >> m;

        FOR(i , 1 , n)
            FOR(j , 1 , m)
                cin >> c[i][j];

        FORD(i , n , 1)
        {
            FORD(j , m , 1)
            {
                if(c[i][j] == 'O')
                    cntO[i] ++;
                if(c[i][j] == 'I')
                    cntI[j] ++;
                if(c[i][j] == 'J')
                    ans += cntO[i] * cntI[j];
            }
        }

        cout << ans;
    }

}

signed main()
{
    ios_base :: sync_with_stdio(false) ; cin.tie(nullptr) ; cout.tie(nullptr) ;
    IO(test);
    MaxPhast :: solve();
    time();
}
/*

*/

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:29:54: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 | #define IO(TASK) if(fopen(#TASK".INP" , "r")){freopen(#TASK".INP" , "r" , stdin); freopen(#TASK".OUT" , "w" , stdout);}
      |                                               ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:90:5: note: in expansion of macro 'IO'
   90 |     IO(test);
      |     ^~
joi2019_ho_t1.cpp:29:90: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 | #define IO(TASK) if(fopen(#TASK".INP" , "r")){freopen(#TASK".INP" , "r" , stdin); freopen(#TASK".OUT" , "w" , stdout);}
      |                                                                                   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:90:5: note: in expansion of macro 'IO'
   90 |     IO(test);
      |     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...