Submission #924020

# Submission time Handle Problem Language Result Execution time Memory
924020 2024-02-08T09:40:16 Z Nurislam Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
275 ms 160056 KB
#include <bits/stdc++.h>
#include <iostream>
//~ #include <ext/pb_ds/assoc_container.hpp> 
//~ #include <ext/pb_ds/tree_policy.hpp> 


using namespace std;
//~ using namespace __gnu_pbds; 
  

#define pb push_back
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define int long long
//~ #define double long double 
//~ #define order_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

///*                                                    __                    __                        __                    */
///*        ======     _      /| /|  __   _            /   |  |   /|  |   @  |    |  |  | /   /| |\  | /   |  |  @ | /        */
///* \-       ||  |_| |_     / |/ | |  | |_  |-        |   |--|  /-|  |   |  \ \  |==|  |-   /=| | \ | |   |--|  | |-         */
///*          ||  | | |_    /     | |__|  _| |_        \__ |  | /  |  |__ |  __|  |  |  | \ /  | |  \| \__ |  |  | | \        */
///* 

typedef vector<int> vi;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef vector<pii> vii;
//~ typedef vector<vi> vv;
const int N = 2e5+2, inf = 1e16, mod = 998244353;
void solve(){
	int h, w;
	cin >> h >> w;
	string a[h];
	for(auto &i:a)cin >> i;
	int ci[h+1][w+1]{};
	for(int i = 0; i < w; i++){
		for(int j = h-1; j >= 0; j--){
			ci[j][i] = ci[j+1][i]+(a[j][i] == 'I');
		}
	}
	int co[h+1][w+1]{};
	for(int i = 0; i < h; i++){
		for(int j = w-1; j >= 0; j--){
			co[i][j] = co[i][j+1] + (a[i][j] == 'O');
		}
	}
	int ans = 0;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(a[i][j] == 'J')ans+=(co[i][j]*ci[i][j]);
		}
	}
	
	cout << ans << '\n';
}
main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int test = 1;
	//~ cin >> test;
	while(test--){
		solve();
	}
}










Compilation message

joi2019_ho_t1.cpp:58:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   58 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 464 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 464 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 4 ms 3672 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 5 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 4 ms 4700 KB Output is correct
21 Correct 5 ms 4728 KB Output is correct
22 Correct 4 ms 4700 KB Output is correct
23 Correct 5 ms 4696 KB Output is correct
24 Correct 6 ms 4956 KB Output is correct
25 Correct 4 ms 4700 KB Output is correct
26 Correct 4 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 464 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 604 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 4 ms 3672 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 5 ms 4700 KB Output is correct
19 Correct 4 ms 4700 KB Output is correct
20 Correct 4 ms 4700 KB Output is correct
21 Correct 5 ms 4728 KB Output is correct
22 Correct 4 ms 4700 KB Output is correct
23 Correct 5 ms 4696 KB Output is correct
24 Correct 6 ms 4956 KB Output is correct
25 Correct 4 ms 4700 KB Output is correct
26 Correct 4 ms 4700 KB Output is correct
27 Correct 254 ms 151056 KB Output is correct
28 Correct 1 ms 860 KB Output is correct
29 Correct 11 ms 11768 KB Output is correct
30 Correct 1 ms 748 KB Output is correct
31 Correct 174 ms 110976 KB Output is correct
32 Correct 260 ms 158956 KB Output is correct
33 Correct 248 ms 159408 KB Output is correct
34 Correct 211 ms 128852 KB Output is correct
35 Correct 257 ms 159096 KB Output is correct
36 Correct 244 ms 159280 KB Output is correct
37 Correct 275 ms 160056 KB Output is correct
38 Correct 158 ms 110404 KB Output is correct
39 Correct 158 ms 110756 KB Output is correct