Submission #253388

#TimeUsernameProblemLanguageResultExecution timeMemory
253388ChrisTBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
106 ms17916 KiB
#include<bits/stdc++.h>
using namespace std;
char grid[3005][3005]; int col[3005], row[3005];
int main () {
	int n,m;
	scanf ("%d %d",&n,&m);
	for (int i = 1; i <= n; i++) scanf ("%s",grid[i]+1);
	long long ans = 0;
	for (int i = n; i >= 1; i--) {
		for (int j = m; j >= 1; j--) {
			if (grid[i][j] == 'J') ans += row[i] * col[j];
			else if (grid[i][j] == 'O') ++row[i];
			else ++col[j];
		}
	}
	printf ("%lld\n",ans);
	return 0;
}

Compilation message (stderr)

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