Submission #162705

#TimeUsernameProblemLanguageResultExecution timeMemory
162705NachoLibreBitaro the Brave (JOI19_ho_t1)C++14
50 / 100
391 ms114516 KiB
#include <bits/stdc++.h>
using namespace std;

unsigned int n, m, d[3003][3003][3], fp;
char a;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			cin >> a;
			if(a == 'J') d[i][j][0] = 1;
			else if(a == 'O') d[i][j][1] = 1;
			else d[i][j][2] = 1;
		}
	}
	for(int i = n; i; --i) {
		for(int j = m; j; --j) {
			d[i][j][1] += d[i][j + 1][1];
			d[i][j][2] += d[i + 1][j][2];
		}
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j <= m; ++j) {
			if(d[i][j][0]) {
				fp += d[i][j][1] * d[i][j][2];
			}
		}
	}
	cout << fp << endl;
	return 0;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:11:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i <= n; ++i) {
                 ~~^~~~
joi2019_ho_t1.cpp:12:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 1; j <= m; ++j) {
                  ~~^~~~
joi2019_ho_t1.cpp:25:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i <= n; ++i) {
                 ~~^~~~
joi2019_ho_t1.cpp:26:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j = 1; j <= m; ++j) {
                  ~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...