样例都过了哪里爆掉了
查看原帖
样例都过了哪里爆掉了
240755
jsy20061005楼主2020/10/6 18:06
#include<bits/stdc++.h>
using namespace std;
const int MAX=5000;
int n,m,a[MAX][MAX],cnt,tmp=0;
char c;
signed main(void){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cin>>c;
			if(c=='*'){
				a[i][j]=1;
				cnt++;
			}		
		}
	}
	/*
	cout<<cnt<<endl;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<endl;
	}
	*/
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			
			//cout<<i<<" "<<j<<endl;
			
			tmp=0;
			for(int p=1;p<=m;p++){
				if(a[p][i]==1){
					tmp++;
				}
			}
			
			//cout<<tmp<<endl;
			
			for(int l=1;l<=n;l++){
				if(a[l][j]==1){
					tmp++;
				}
			}
			
			//cout<<tmp<<endl;
			
			if(tmp>=cnt){
				cout<<"YES"<<endl;
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	}
	cout<<"NO"<<endl;
	return 0;
}
2020/10/6 18:06
加载中...