# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
230044 | 2020-05-07T21:02:15 Z | nickmet2004 | Bitaro the Brave (JOI19_ho_t1) | C++11 | 5 ms | 384 KB |
#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 2005; int H , W; string s[N]; int Jo[N][N] , Ji[N][N]; ll solve(){ for(int i = 0; i < H; ++i){ int cntO = 0; for(int j = W - 1; j >= 0; --j){ if(s[i][j] == 'O') ++cntO; if(s[i][j] == 'J') Jo[i][j] = cntO; } } for(int i = 0; i < W; ++i){ int cntI = 0; for(int j = H - 1; j>= 0; --j){ if(s[j][i] == 'I') ++cntI; if(s[j][i] == 'J') Ji[j][i] = cntI; } } ll ans = 0; for(int i = 0; i < H; ++i){ for(int j = 0; j < W; ++j){ ans += 1LL * (Jo[i][j] * Ji[i][j]); } } } int main (){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> H >> W; for(int i = 0; i < H; ++i) cin >> s[i]; cout << solve() << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |