제출 #208461

#제출 시각아이디문제언어결과실행 시간메모리
208461AlainSuBitaro the Brave (JOI19_ho_t1)C++14
0 / 100
6 ms1656 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN=3003, MAXM=3003; char s[3010][3010]={}; long long O[MAXN][MAXM]={},I[MAXN][MAXM]={},n,m; double ans=0; void input() { cin>>n>>m; for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) cin>>s[i][j]; } void getO() { for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) { if (j!=1) {O[i][j]=O[i][j-1];}; if (s[i][j]=='O') {O[i][j]++;}; } } void getI() { for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) { if (i!=1) {I[i][j]=I[i-1][j];}; if (s[i][j]=='I') {I[i][j]++;}; } } void process() { for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (s[i][j]=='J') { ans+=(I[n][j]-I[i][j])*(O[i][m]-O[i][j]); } } void output() { cout<<ans; } int main() { //freopen("C:/TEST/stoveout.txt","r",stdin); //freopen("C:/TEST/stoveoutout.txt","w",stdout); input(); getO(); getI(); process(); output(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...