# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
724848 | guagua0407 | Bitaro the Brave (JOI19_ho_t1) | C++17 | 212 ms | 17920 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.
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define _ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
int main() {_
int n,m;
cin>>n>>m;
char num[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>num[i][j];
}
}
vector<int> cnt2(m,0);
for(int j=0;j<m;j++){
for(int i=0;i<n;i++){
if(num[i][j]=='I') cnt2[j]++;
}
}
ll ans=0;
for(int i=0;i<n;i++){
int cnt=0;
for(int j=m-1;j>=0;j--){
if(num[i][j]=='I') cnt2[j]--;
if(num[i][j]=='O') cnt++;
if(num[i][j]=='J'){
ans+=cnt*cnt2[j];
}
}
}
cout<<ans;
return 0;
}
//maybe its multiset not set
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... |