# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151097 | karma | Bitaro the Brave (JOI19_ho_t1) | C++14 | 93 ms | 10232 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) + 1;
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 = 0; i < n; ++i) cin >> s[i];
for(int i = n - 1; i >= 0; --i) {
cur = 0;
for(int j = 0; j < m; ++j) {
if(s[i][j] == 'J') cur += c[j];
else if(s[i][j] == 'I') ++c[j];
else 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... |