結果

問題 No.455 冬の大三角
ユーザー Yut176
提出日時 2016-12-12 15:59:04
言語 C++11
(gcc 4.8.5)
結果
AC  
実行時間 5 ms
コード長 858 Byte
コンパイル時間 504 ms
使用メモリ 1,556 KB
最終ジャッジ日時 2019-09-12 05:57:56

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
0_sample1.txt AC 3 ms
1,532 KB
0_sample2.txt AC 3 ms
1,516 KB
0_sample3.txt AC 3 ms
1,540 KB
1_hand1.txt AC 3 ms
1,520 KB
1_hand2.txt AC 3 ms
1,536 KB
1_hand3.txt AC 3 ms
1,532 KB
1_hand4.txt AC 3 ms
1,516 KB
1_hand5.txt AC 3 ms
1,516 KB
1_hand6.txt AC 5 ms
1,552 KB
2_small1.txt AC 3 ms
1,532 KB
2_small2.txt AC 3 ms
1,520 KB
2_small3.txt AC 3 ms
1,532 KB
2_small4.txt AC 3 ms
1,520 KB
2_small5.txt AC 3 ms
1,532 KB
2_small6.txt AC 3 ms
1,516 KB
2_small7.txt AC 3 ms
1,520 KB
2_small8.txt AC 3 ms
1,528 KB
2_small9.txt AC 3 ms
1,516 KB
2_small10.txt AC 3 ms
1,532 KB
2_small11.txt AC 3 ms
1,532 KB
2_small12.txt AC 3 ms
1,532 KB
2_small13.txt AC 3 ms
1,520 KB
2_small14.txt AC 3 ms
1,528 KB
2_small15.txt AC 3 ms
1,516 KB
2_small16.txt AC 3 ms
1,528 KB
2_small17.txt AC 3 ms
1,520 KB
2_small18.txt AC 4 ms
1,532 KB
2_small19.txt AC 4 ms
1,532 KB
2_small20.txt AC 3 ms
1,532 KB
3_test1.txt AC 4 ms
1,556 KB
3_test2.txt AC 3 ms
1,544 KB
3_test3.txt AC 4 ms
1,540 KB
3_test4.txt AC 3 ms
1,540 KB
3_test5.txt AC 4 ms
1,552 KB
3_test6.txt AC 3 ms
1,540 KB
3_test7.txt AC 4 ms
1,544 KB
3_test8.txt AC 4 ms
1,548 KB
3_test9.txt AC 4 ms
1,544 KB
3_test10.txt AC 3 ms
1,544 KB
3_test11.txt AC 4 ms
1,552 KB
3_test12.txt AC 4 ms
1,548 KB
3_test13.txt AC 3 ms
1,544 KB
3_test14.txt AC 4 ms
1,540 KB
3_test15.txt AC 3 ms
1,540 KB
3_test16.txt AC 3 ms
1,540 KB
3_test17.txt AC 4 ms
1,548 KB
3_test18.txt AC 4 ms
1,548 KB
3_test19.txt AC 4 ms
1,544 KB
3_test20.txt AC 4 ms
1,544 KB
99_challenge01.txt AC 3 ms
1,528 KB
99_system_test1.txt AC 3 ms
1,528 KB
99_system_test2.txt AC 3 ms
1,540 KB
system_test1.txt AC 4 ms
1,536 KB
system_test2.txt AC 3 ms
1,540 KB
system_test3.txt AC 3 ms
1,536 KB
system_test4.txt AC 3 ms
1,540 KB
system_test5.txt AC 3 ms
1,536 KB
テストケース一括ダウンロード

ソースコード

diff #
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
using namespace std;

int main(){

  int h, w;
  cin >> h >> w;
  vector<string> s(h);
  for(int i=0; i<h; i++) cin >> s[i];

  vector< pair<int, int> > star;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      if( s[i][j] == '*' ) star.push_back( make_pair(i, j) );
    }
  }

  if( star[0].first == star[1].first ){
    s[ (star[0].first+1)%h ][ star[0].second ] = '*';
  }else if( star[0].second == star[1].second ){
    s[ (star[0].first) ][ (star[0].second+1)%w ] = '*';
  }else{
    s[ (star[0].first) ][ star[1].second ] = '*';
  }

  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      cout << s[i][j];
    }
    cout << endl;
  }

  return 0;
}
0