# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
110425 | said | Bitaro the Brave (JOI19_ho_t1) | C++14 | 436 ms | 155832 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 <iostream>
using namespace std;
#define int long long
#define MAX 3100
string s[MAX];
int h, w, v1[MAX][MAX], v2[MAX][MAX];
main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> h >> w;
for(int i = 0; i < h; i++)
cin >> s[i];
int qt = 0;
for(int j = 0; j < w; j++){
qt = 0;
for(int i = h-1; i >= 0; i--){
v1[i][j] += qt;
if(s[i][j] == 'I'){
qt++;
}
}
}
for(int i = 0; i < h; i++){
qt = 0;
for(int j = w-1; j >= 0; j--){
v2[i][j] += qt;
if(s[i][j] == 'O'){
qt++;
}
}
}
int ans = 0;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++){
if(s[i][j] == 'J'){
ans += v1[i][j]*v2[i][j];
}
}
}
cout << ans << "\n";
return 0;
}
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... |