Submission #171987

# Submission time Handle Problem Language Result Execution time Memory
171987 2019-12-30T18:16:20 Z cheissmart Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
2 ms 504 KB
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

char a[3003][3003];

int I[3003][3003], O[3003][3003];

signed main()
{
	IO_OP;
	
	int n, m;
	cin >> n >> m;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			cin >> a[i][j];
	ll ans = 0;
	for(int i=1;i<=n;i++)
		for(int j=m;j>=1;j--)
			O[i][j] = O[i][j+1] + (a[i][j] == 'O');
	for(int j=1;j<=m;j++)
		for(int i=m;i>=1;i--)
			I[i][j] = I[i+1][j] + (a[i][j] == 'I');
	for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)
			if(a[i][j] == 'J')
				ans += (ll) O[i][j] * I[i][j];
	cout << ans << endl;
	
}



# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Incorrect 2 ms 504 KB Output isn't correct
5 Halted 0 ms 0 KB -