# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
128324 | miguel | Bitaro the Brave (JOI19_ho_t1) | C++14 | 32 ms | 21676 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>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define x first
#define y second
#define pi pair <int, int>
#define pii pair <int, pi>
#define vi vector <int>
const ll mod = 1e9 + 7;
int n, m, t[7][3003][3003], ans;
int get(char c){
if(c=='J') return 1;
else if(c=='I') return 2;
else if(c=='O') return 3;
}
int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
cin>>n>>m;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
char c;
cin>>c;
t[0][i][j]=get(c);
for(int idx=1; idx<=3; idx++) t[idx][i][j]=t[idx][i][j-1];
for(int idx=4; idx<=6; idx++) t[idx][i][j]=t[idx][i-1][j];
t[get(c)][i][j]++;
t[get(c)+3][i][j]++;
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(t[0][i][j]==1) ans+=(t[3][i][m]-t[3][i][j])*(t[5][n][j]-t[5][i][j]);
}
}
cout<<ans;
}
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... |