Submission #387827

#TimeUsernameProblemLanguageResultExecution timeMemory
387827ismoilovBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
239 ms88424 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define fp(a,i,c) for(int (a) = (i); (a) < (c); (a)++)
#define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
#define fv(c) for(int (a) = (1); (a) <= (c); (a)++)
#define fz(c) for(int (a) = (0); (a) < (c); (a)++)
#define fm(a,i,c) for(int (a) = (i); (a) > (c); (a)--)
#define fmm(a,i,c) for(int (a) = (i); (a) >= (c); (a)--)
#define pb push_back
#define in insert
#define ss second
#define ff first
const int maxx = 3e3+3;
char a[maxx][maxx];
int I[maxx][maxx], O[maxx][maxx];
void S()
{
	int n, m;
	cin >> n >> m;
	fpp(i,1,n)
		fpp(j,1,m){
			cin >> a[i][j];
			I[i][j] = I[i-1][j] + (a[i][j] == 'I');
			O[i][j] = O[i][j-1] + (a[i][j] == 'O');
		}
	ll ans = 0;
	fpp(i,1,n)
		fpp(j,1,m){
			if(a[i][j] == 'J'){
				ll x = O[i][m] - O[i][j-1], y = I[n][j] - I[i-1][j];
				ans += x*y;
			}
		}
	cout << ans;
}
int main()
{
	IOS;
	S();
	/*int t;
	cin >> t;
	while(t--)
		 S();*/
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'void S()':
joi2019_ho_t1.cpp:10:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
joi2019_ho_t1.cpp:26:2: note: in expansion of macro 'fpp'
   26 |  fpp(i,1,n)
      |  ^~~
joi2019_ho_t1.cpp:10:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
joi2019_ho_t1.cpp:27:3: note: in expansion of macro 'fpp'
   27 |   fpp(j,1,m){
      |   ^~~
joi2019_ho_t1.cpp:10:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
joi2019_ho_t1.cpp:33:2: note: in expansion of macro 'fpp'
   33 |  fpp(i,1,n)
      |  ^~~
joi2019_ho_t1.cpp:10:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fpp(a,i,c) for(int (a) = (i); (a) <= (c); (a)++)
      |                            ^
joi2019_ho_t1.cpp:34:3: note: in expansion of macro 'fpp'
   34 |   fpp(j,1,m){
      |   ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...