Submission #123983

# Submission time Handle Problem Language Result Execution time Memory
123983 2019-07-02T10:26:08 Z ioilolcom Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
867 ms 75116 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pii pair<int,int>
typedef long long int ll;
vector<pii> jj;
const int N=3005;
vector<int> o[N];
vector<int>  l[N];
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n,m; cin>>n>>m;
	for(int i=1; i<=n; i++) {
		for(int j=1; j<=m; j++) {
			char c;
			cin>>c;
			if(c=='J') jj.push_back({i,j});
			else if(c=='O') o[i].push_back(j);
			else if(c=='I') l[j].push_back(i);
		}
	}
	ll lol=0;
	for(auto a:jj) {
		int f=a.first;
		int s=a.second;
		//cout<<f<<" "<<s<<endl;
		/*for(int z:l[s]) {
		        cout<<z<<" "<<s<<endl;
		   }*/
		int ans=o[f].end()-upper_bound(o[f].begin(),o[f].end(),s);

		int anss=l[s].end()-upper_bound(l[s].begin(),l[s].end(),f);
		//cout<<ans<<" "<<anss<<endl;
		lol+=ans*anss;
		//break;
	}

	cout<<lol<<endl;

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 632 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 632 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 632 KB Output is correct
14 Correct 16 ms 2044 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 7 ms 1524 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 20 ms 2668 KB Output is correct
19 Correct 10 ms 2040 KB Output is correct
20 Correct 10 ms 2104 KB Output is correct
21 Correct 22 ms 2672 KB Output is correct
22 Correct 13 ms 2416 KB Output is correct
23 Correct 10 ms 2104 KB Output is correct
24 Correct 22 ms 2416 KB Output is correct
25 Correct 11 ms 2292 KB Output is correct
26 Correct 11 ms 2124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 2 ms 504 KB Output is correct
8 Correct 3 ms 632 KB Output is correct
9 Correct 2 ms 504 KB Output is correct
10 Correct 2 ms 632 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 2 ms 504 KB Output is correct
13 Correct 2 ms 632 KB Output is correct
14 Correct 16 ms 2044 KB Output is correct
15 Correct 2 ms 504 KB Output is correct
16 Correct 7 ms 1524 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 20 ms 2668 KB Output is correct
19 Correct 10 ms 2040 KB Output is correct
20 Correct 10 ms 2104 KB Output is correct
21 Correct 22 ms 2672 KB Output is correct
22 Correct 13 ms 2416 KB Output is correct
23 Correct 10 ms 2104 KB Output is correct
24 Correct 22 ms 2416 KB Output is correct
25 Correct 11 ms 2292 KB Output is correct
26 Correct 11 ms 2124 KB Output is correct
27 Correct 771 ms 62280 KB Output is correct
28 Correct 3 ms 760 KB Output is correct
29 Correct 27 ms 5604 KB Output is correct
30 Correct 4 ms 760 KB Output is correct
31 Correct 545 ms 44448 KB Output is correct
32 Correct 420 ms 61056 KB Output is correct
33 Correct 445 ms 64936 KB Output is correct
34 Correct 642 ms 61520 KB Output is correct
35 Correct 539 ms 65332 KB Output is correct
36 Correct 404 ms 64756 KB Output is correct
37 Correct 867 ms 75116 KB Output is correct
38 Correct 227 ms 41868 KB Output is correct
39 Correct 273 ms 49700 KB Output is correct