Submission #387827

# Submission time Handle Problem Language Result Execution time Memory
387827 2021-04-09T09:01:20 Z ismoilov Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
239 ms 88424 KB
#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

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 time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 552 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1480 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 552 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1480 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 8 ms 7500 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 5 ms 4300 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 10 ms 8012 KB Output is correct
19 Correct 9 ms 7884 KB Output is correct
20 Correct 9 ms 7756 KB Output is correct
21 Correct 10 ms 8012 KB Output is correct
22 Correct 9 ms 7900 KB Output is correct
23 Correct 11 ms 7756 KB Output is correct
24 Correct 10 ms 8012 KB Output is correct
25 Correct 9 ms 7884 KB Output is correct
26 Correct 9 ms 7756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 552 KB Output is correct
5 Correct 1 ms 1484 KB Output is correct
6 Correct 1 ms 1480 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1488 KB Output is correct
9 Correct 1 ms 1484 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 1 ms 1484 KB Output is correct
12 Correct 1 ms 1484 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 8 ms 7500 KB Output is correct
15 Correct 3 ms 4940 KB Output is correct
16 Correct 5 ms 4300 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 10 ms 8012 KB Output is correct
19 Correct 9 ms 7884 KB Output is correct
20 Correct 9 ms 7756 KB Output is correct
21 Correct 10 ms 8012 KB Output is correct
22 Correct 9 ms 7900 KB Output is correct
23 Correct 11 ms 7756 KB Output is correct
24 Correct 10 ms 8012 KB Output is correct
25 Correct 9 ms 7884 KB Output is correct
26 Correct 9 ms 7756 KB Output is correct
27 Correct 223 ms 87852 KB Output is correct
28 Correct 14 ms 26004 KB Output is correct
29 Correct 16 ms 7756 KB Output is correct
30 Correct 1 ms 588 KB Output is correct
31 Correct 166 ms 72560 KB Output is correct
32 Correct 200 ms 88344 KB Output is correct
33 Correct 196 ms 88104 KB Output is correct
34 Correct 193 ms 84208 KB Output is correct
35 Correct 201 ms 88388 KB Output is correct
36 Correct 194 ms 88060 KB Output is correct
37 Correct 239 ms 88424 KB Output is correct
38 Correct 143 ms 72388 KB Output is correct
39 Correct 143 ms 72180 KB Output is correct