Submission #99003

#TimeUsernameProblemLanguageResultExecution timeMemory
99003kriiiBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
164 ms80488 KiB
#include <stdio.h>

int H,W; char S[3030][3030]; int A[3030][3030],B[3030][3030];

int main()
{
	scanf ("%d %d",&H,&W);
	for (int i=0;i<H;i++) scanf ("%s",S[i]);

	long long ans = 0;
	for (int i=H-1;i>=0;i--) for (int j=W-1;j>=0;j--){
		A[i][j] = A[i+1][j];
		B[i][j] = B[i][j+1];
		if (S[i][j] == 'I') A[i][j]++;
		if (S[i][j] == 'O') B[i][j]++;
		if (S[i][j] == 'J') ans += (long long) A[i][j] * B[i][j];
	}

	printf ("%lld\n",ans);

	return 0;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:7:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf ("%d %d",&H,&W);
  ~~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0;i<H;i++) scanf ("%s",S[i]);
                        ~~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...