이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define OYY LLONG_MAX
#define mod 1000000007
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define lim 3005
#define fi first
#define se second
int O[lim][lim],I[lim][lim];
char dizi[lim][lim];
int32_t main(){
faster
int n,m;cin>>n>>m;
FOR{
string s;cin>>s;
for(int j=1;j<=m;j++){
dizi[i][j]=s[j-1];
}
}
FOR{
for(int j=1;j<=m;j++){
O[i][j]=O[i][j-1];
if(dizi[i][j]=='O')O[i][j]++;
}
}
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
I[j][i]=I[j-1][i];
if(dizi[j][i]=='I')I[j][i]++;
}
}
int cev=0;
FOR{
for(int j=1;j<=m;j++){
if(dizi[i][j]=='J')cev+=(O[i][m]-O[i][j])*(I[n][j]-I[i][j]);
//cout<<(O[i][m]-O[i][j])<<" "<<(I[n][j]-I[i][j])<<endl;
}
}
cout<<cev<<'\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |