# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
197453 | quocnguyen1012 | Bitaro the Brave (JOI19_ho_t1) | C++14 | 218 ms | 18004 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
const int base = 131;
const int maxn = 3e3 + 5;
int N, M;
char type[maxn][maxn];
int col[maxn];
signed main(void)
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if (fopen("A.INP", "r")){
freopen("A.INP", "r", stdin);
freopen("A.OUT", "w", stdout);
}
cin >> N >> M;
for (int i = 1; i <= N; ++i){
for (int j = 1; j <= M; ++j){
cin >> type[i][j];
}
}
ll res = 0;
for (int i = N; i >= 1; --i){
int have = 0;
for (int j = M; j >= 1; --j){
if (type[i][j] == 'O'){
++have;
}
else if (type[i][j] == 'I'){
++col[j];
}
else res += 1ll * have * col[j];
}
}
cout << res << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |