Submission #157928

#TimeUsernameProblemLanguageResultExecution timeMemory
157928GioChkhaidzeBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
520 ms88632 KiB
#include <bits/stdc++.h>
using namespace std;
const int N=3005;
int n,m,Orb[N][N],Ingot[N][N];
long long ANS;
char c[N][N];
main () {
	ios::sync_with_stdio(false);
	cin>>n>>m;
	
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=m; j++)
			cin>>c[i][j];
	}	
	
	for (int i=1; i<=n; i++) {
		int cnt=0;
		for (int j=m; j>=1; j--) {
			Orb[i][j]=cnt;
			cnt+=(c[i][j]=='O');
		}
	}
	
	for (int j=1; j<=m; j++) {
		int cnt=0;
		for (int i=n; i>=1; i--)  {
			Ingot[i][j]=cnt;
			cnt+=(c[i][j]=='I');
		}
	}
	
	for (int i=1; i<=n; i++) {
		for (int j=1; j<=m; j++)
			if (c[i][j]=='J') ANS+=Ingot[i][j]*Orb[i][j];
	}
	
	cout<<ANS<<endl;
}

Compilation message (stderr)

joi2019_ho_t1.cpp:7:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...