Submission #1180791

#TimeUsernameProblemLanguageResultExecution timeMemory
1180791Fikrat_AsadzadehBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
278 ms151300 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define FORI(i, n) for(ll i = 0; i < n; i++) #define FOR(i, n) for(ll i = 1; i <= n; i++) typedef vector < ll > vl; typedef set < ll > setl; #define ff first #define ss second #define all(v) v.begin(), v.end() #define pll pair<ll, ll> #define db double #define nll cout << "\n" #define nl "\n" #define sync ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); ll poww(ll a, ll b){ ll res = 1; while(b){ if(b & 1)res *= a; a *= a; b >>= 1; } return res; } const ll mod = 998244353; const int sz = 3000 + 23 ; const long long imax = LLONG_MAX; ll n, m, k, res, q, x, y; ll osuf[sz][sz], isuf[sz][sz]; char c[sz][sz]; void solve(){ cin >> n >> m; FOR(i, n){ FOR(j, m)cin >> c[i][j]; } FOR(i, n){ for(ll j = m; j >= 1; j--){ if(j < m)osuf[i][j] = osuf[i][j + 1]; osuf[i][j] += c[i][j] == 'O'; } } FOR(j, m){ for(ll i = n; i >= 1; i--){ if(i < n)isuf[i][j] = isuf[i + 1][j]; isuf[i][j] += c[i][j] == 'I'; } } ll res= 0 ; FOR(i, n){ FOR(j, m){ // cout << "sa"; if(c[i][j] == 'J')res += isuf[i][j] * osuf[i][j]; } } cout << res; } //IOI rice hub signed main(){ // freopen("input.txt","r",stdin);a // freopen("output.txt","w",stdout); sync; ll t = 1; // cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...