Submission #531985

#TimeUsernameProblemLanguageResultExecution timeMemory
531985nguyentunglamBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
281 ms9168 KiB
#include<bits/stdc++.h>
#define forin(i, a, b) for(int i = a; i <= b; i++)
#define forde(i, a, b) for(int i = a; i >= b; i--)
#define fi first 
#define se second
#define ll long long
using namespace std;
const int N = 3e3 + 10;
char a[N][N];
int row[N], col[N];
long long res; 
int main()
{
	int h, w; cin >> h >> w;
	forin(i, 1, h) 
	{
		string s; cin >> s;
		forin(j, 0, s.size()-1) a[i][j+1] = s[j];
	}
	forde(i, h, 1) forde(j, w, 1) 
	{
		if (a[i][j] == 'O') row[i]++;
		if (a[i][j] == 'I') col[j]++;
		if (a[i][j] == 'J') res +=row[i]*col[j];
	}
	cout << res;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:2:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    2 | #define forin(i, a, b) for(int i = a; i <= b; i++)
......
   18 |   forin(j, 0, s.size()-1) a[i][j+1] = s[j];
      |         ~~~~~~~~~~~~~~~~                 
joi2019_ho_t1.cpp:18:3: note: in expansion of macro 'forin'
   18 |   forin(j, 0, s.size()-1) a[i][j+1] = s[j];
      |   ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...