結果

問題 No.455 冬の大三角
ユーザー かにかに
提出日時 2017-03-27 23:09:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,209 bytes
コンパイル時間 1,630 ms
コンパイル使用メモリ 170,416 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 12:37:23
合計ジャッジ時間 5,902 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,380 KB
testcase_47 AC 2 ms
4,376 KB
testcase_48 AC 2 ms
4,380 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 AC 2 ms
4,380 KB
testcase_51 AC 2 ms
4,376 KB
testcase_52 AC 2 ms
4,376 KB
testcase_53 AC 2 ms
4,376 KB
testcase_54 AC 1 ms
4,376 KB
testcase_55 AC 2 ms
4,376 KB
testcase_56 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘void solve()’ 内:
main.cpp:45:9: 警告: ‘ny’ may be used uninitialized [-Wmaybe-uninitialized]
   45 |   vec[ny][nx] = '*';
      |         ^
main.cpp:24:10: 備考: ‘ny’ はここで定義されています
   24 |   int nx,ny;
      |          ^~
main.cpp:45:13: 警告: ‘nx’ may be used uninitialized [-Wmaybe-uninitialized]
   45 |   vec[ny][nx] = '*';
      |             ^
main.cpp:24:7: 備考: ‘nx’ はここで定義されています
   24 |   int nx,ny;
      |       ^~

ソースコード

diff #

#include "bits/stdc++.h"
#define _CRT_SECURE_NO_WARNINGS
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define mp(a,b) make_pair(a,b)
using namespace std;typedef long long ll;typedef unsigned long long ull;int dx[] = { 1, -1 , 0 , 0};int dy[] = { 0,  0,  1, -1};

void solve() {
  int h,w;
  vector<pair<int,int> > p;
  cin >> h >> w;
  vector<string> vec(h);
  rep(i,h){
    cin >> vec[i];
    rep(j,w){
      if(vec[i][j] == '*'){
	p.push_back(make_pair(i,j));
      }
    }
  }
  int nx,ny;
  if(p[0].first == p[1].first){
    if(p[0].first + 1 < h){
      nx = p[0].second;
      ny = p[0].first+1;
    }else if(p[0].first - 1 >= 0){
      nx = p[0].second;
      ny = p[0].first-1;
    }
  }else if(p[0].second == p[1].second){
    if(p[0].second + 1  < w){
      nx = p[0].second+1;
      ny = p[0].first;
    }else if(p[0].second - 1 >= 0){
      nx = p[0].second-1;
      ny = p[0].first;
    }
  }else{
    nx = p[0].second;
    ny = p[1].first;
  }
  vec[ny][nx] = '*';
  rep(i,h){
    P(vec[i]);
  }
}

int main() {
	solve();
	return 0;
}
0