# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151093 | karma | Bitaro the Brave (JOI19_ho_t1) | C++14 | 102 ms | 18168 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 ll long long
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
const int N = int(3e3) + 2;
const int mod = int(1e9) + 7;
string s[N];
ll res = 0;
int n, m, c[N], cur;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
if(fopen("test.inp", "r")) {
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
}
cin >> n >> m;
for(int i = 1; i <= n; ++i) cin >> s[i], s[i] = ' ' + s[i];
for(int i = n; i >= 1; --i) {
cur = 0;
for(int j = 1; j <= m; ++j) {
if(s[i][j] == 'J') cur += c[j];
else if(s[i][j] == 'I') ++c[j];
else if(s[i][j] == 'O') res += cur;
}
}
cout << res;
}
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... |