Submission #381632

# Submission time Handle Problem Language Result Execution time Memory
381632 2021-03-25T11:46:01 Z Iwanttobreakfree Bitaro the Brave (JOI19_ho_t1) C++17
50 / 100
1000 ms 16412 KB
#include <iostream>
#include <vector>
using namespace std;
int main(){
	long long int h,w;
	cin>>h>>w;
	char grid[h][w];
	int canti[h][w];
	int canto[h][w];
	vector<pair<int,int> > v;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin>>grid[i][j];
			canti[i][j]=0;
			canto[i][j]=0;
			if(grid[i][j]=='J')v.push_back(make_pair(i,j));
			if(grid[i][j]=='I'){
				for(int x=i;x>=0;x--)canti[x][j]++;
			}
			if(grid[i][j]=='O'){
				for(int x=j;x>=0;x--)canto[i][x]++;
			}
		}
	}
	int n=v.size();
	long long int sol=0;
	for(int j=0;j<n;j++){
		int x=v[j].first,y=v[j].second;
		sol+=canti[x][y]*canto[x][y];
	}
	cout<<sol<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 368 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 2 ms 492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 368 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 2 ms 492 KB Output is correct
14 Correct 61 ms 2660 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 31 ms 1892 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 85 ms 3300 KB Output is correct
19 Correct 99 ms 2664 KB Output is correct
20 Correct 114 ms 3168 KB Output is correct
21 Correct 87 ms 3296 KB Output is correct
22 Correct 78 ms 3168 KB Output is correct
23 Correct 117 ms 3320 KB Output is correct
24 Correct 75 ms 3424 KB Output is correct
25 Correct 89 ms 2792 KB Output is correct
26 Correct 117 ms 3264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 368 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 2 ms 364 KB Output is correct
7 Correct 2 ms 492 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 2 ms 512 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 2 ms 364 KB Output is correct
13 Correct 2 ms 492 KB Output is correct
14 Correct 61 ms 2660 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Correct 31 ms 1892 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 85 ms 3300 KB Output is correct
19 Correct 99 ms 2664 KB Output is correct
20 Correct 114 ms 3168 KB Output is correct
21 Correct 87 ms 3296 KB Output is correct
22 Correct 78 ms 3168 KB Output is correct
23 Correct 117 ms 3320 KB Output is correct
24 Correct 75 ms 3424 KB Output is correct
25 Correct 89 ms 2792 KB Output is correct
26 Correct 117 ms 3264 KB Output is correct
27 Execution timed out 1090 ms 16412 KB Time limit exceeded
28 Halted 0 ms 0 KB -