Submission #603270

#TimeUsernameProblemLanguageResultExecution timeMemory
603270IvanJBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
61 ms17956 KiB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int maxn = 3005;

int n, m;
char mat[maxn][maxn];
int O[maxn], I[maxn];

int main() {
	scanf("%d%d", &n, &m);
	for(int i = 0;i < n;i++) scanf("%s", mat[i]);
	ll ans = 0;
	for(int i = n - 1;i >= 0;i--) {
		for(int j = m - 1;j >= 0;j--) {
			O[i] += (mat[i][j] == 'O');
			I[j] += (mat[i][j] == 'I');
			ans += (ll)(mat[i][j] == 'J') * (O[i] * I[j]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Compilation message (stderr)

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