Submission #383092

#TimeUsernameProblemLanguageResultExecution timeMemory
383092MODDIBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
61 ms2156 KiB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define mp make_pair
#define pb push_back
using namespace std;
int n, m, rez = 0;
char mat[3030][3030];
int main(){
	cin>>n>>m;
	for(int i = 0; i < n; i++){
		string a;
		cin>>a;
		for(int j = 0; j < m; j++){
			mat[i][j] = a[j];	
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(mat[i][j] == 'J'){
				int lcnt = 0, kcnt = 0;
				for(int l = j + 1; l < m; l++){
					if(mat[i][l] == 'O'){
						lcnt++;
					}
					else
						continue;
				}
				for(int k = i + 1; k < n; k++){
					if(mat[k][j] == 'I'){
						kcnt++;
					}
					else
						continue;
				}
					rez += (kcnt * lcnt);
			}
			else
				continue;
		}
	}
	cout<<rez<<endl; 
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...