Submission #121269

#TimeUsernameProblemLanguageResultExecution timeMemory
121269onjo0127Bitaro the Brave (JOI19_ho_t1)C++11
100 / 100
558 ms85704 KiB
#include <bits/stdc++.h>
using namespace std;

char A[3009][3009];
int O[3009][3009], I[3009][3009];

int main() {
	int H, W; scanf("%d%d",&H,&W);
	for(int i=1; i<=H; i++) {
		for(int j=1; j<=W; j++) {
			scanf(" %c", &A[i][j]);
			O[i][j] = O[i][j-1];
			I[i][j] = I[i-1][j];
			if(A[i][j] == 'O') ++O[i][j];
			if(A[i][j] == 'I') ++I[i][j];
		}
	}
	long long ans = 0;
	for(int i=1; i<=H; i++) {
		for(int j=1; j<=W; j++) {
			if(A[i][j] == 'J') ans += 1LL * (O[i][W] - O[i][j]) * (I[H][j] - I[i][j]);
		}
	}
	printf("%lld", ans);
	return 0;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int H, W; scanf("%d%d",&H,&W);
            ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:11:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c", &A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...