Submission #110344

# Submission time Handle Problem Language Result Execution time Memory
110344 2019-05-10T17:47:57 Z sams Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 3e3+10;

int h, w;
char mat[maxn][maxn];
int sumO[maxn][maxn], sumI[maxn][maxn];

int main()
{
	cin >> h >> w;

	for(int i = 1 ; i <= h ; ++i)
		for(int j = 1 ; j <= w; ++j)
			cin >> mat[i][j];

	// make a sum of eche O
	for(int i = 1 ; i <= h ; ++i)
	{
		for(int j = 1 ; j <= w; ++j)
		{
			sumO[i][j] = sumO[i][j - 1];
			if(mat[i][j] == 'O') 
				sumO[i][j]++;
		}
	}

	for(int i = 1 ; i <= w ; ++i)
	{
		for(int j = 1 ; j <= h; ++j)
		{
			sumI[j][i] = sumI[j - 1][i];
			if(mat[j][i] == 'I') 
				sumI[j][i]++;
		}
	}

	int resp = 0;
	for(int i = 1 ; i <= h ; ++i)
	{
		for(int j = 1 ; j <= w; ++j)
		{	
			if(mat[i][j] == 'J')
			{

				int O = sumO[i][w] - sumO[i][j];
				int I = sumI[h][j] - sumI[i - 1][j];

				cout <<  i << " " << j << " " << O << " " << I << "\n" ;
				resp += (O*I);
			}
		}
	}
	cout << resp << "\n";
	/*for(int i = 1 ; i <= h ; ++i)
	{
		for(int j = 1 ; j <= w; ++j)
		{
			cout << sumO[i][j] <<" ";
		}
		cout << "\n";
	}
		cout << "\n";

	for(int i = 1 ; i <= h ; ++i)
	{
		for(int j = 1 ; j <= w; ++j)
		{
			cout << sumI[i][j] <<" ";
		}
		cout << "\n";
	}*/
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -