結果

問題 No.455 冬の大三角
ユーザー fiord
提出日時 2017-03-01 14:47:00
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 72,440 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 23:47:15
合計ジャッジ時間 2,632 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <utility>
using namespace std;
int main(){
	int h,w;	cin>>h>>w;
	vector<string> s(h);
	vector<pair<int,int>> a;
	for(int i=0;i<h;i++){
		cin>>s[i];
		for(int j=0;j<w;j++){
			if(s[i][j]=='*')	a.push_back(make_pair(i,j));
		}
	}
	if((a[0].first!=a[1].first)&&(a[0].second!=a[1].second)){
		s[a[0].first][a[1].second]='*';
	}
	else if(a[0].first!=a[1].first){
		if(a[0].second==0)	s[a[0].first][1]='*';
		else 	s[a[0].first][0]='*';
	}
	else{
		if(a[0].first==0)	s[1][a[0].second]='*';
		else 	s[0][a[0].second]='*';
	}
	for(int i=0;i<h;i++)	cout<<s[i]<<endl;
	return 0;
}
0