Submission #208426

# Submission time Handle Problem Language Result Execution time Memory
208426 2020-03-11T07:53:41 Z AlainSu Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
9 ms 632 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=3010, MAXM=3010;
string s[3010];
int O[MAXN][MAXM]={},I[MAXN][MAXM]={},n,m;
long long 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()
{
    input();
    getO();
    getI();
    process();
    output();
    return 0;
} 
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 508 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Runtime error 9 ms 632 KB Execution killed with signal 7 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 508 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Runtime error 9 ms 632 KB Execution killed with signal 7 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 508 KB Output is correct
4 Correct 5 ms 504 KB Output is correct
5 Runtime error 9 ms 632 KB Execution killed with signal 7 (could be triggered by violating memory limits)
6 Halted 0 ms 0 KB -