Submission #1146174

#TimeUsernameProblemLanguageResultExecution timeMemory
1146174zhasynBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
87 ms9544 KiB
#include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 3000 + 100, M = 4096 + 10, len = 21, inf = 1e18; const ll mod = 1e9 + 7; ll cnt[N]; char a[N][N]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); ll n, m, ans = 0; cin >> n >> m; for(ll i = 1; i <= n; i++){ string s; cin >> s; for(ll j = 1; j <= m; j++){ a[i][j] = s[j - 1]; if(a[i][j] == 'I') cnt[j]++; } } for(ll i = 1; i <= n; i++){ ll sum = 0; for(ll j = 1; j <= m; j++){ if(a[i][j] == 'I') cnt[j]--; if(a[i][j] == 'J') sum += cnt[j]; if(a[i][j] == 'O') ans += sum; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...