結果

問題 No.455 冬の大三角
ユーザー srup٩(๑`н´๑)۶srup٩(๑`н´๑)۶
提出日時 2016-12-06 17:31:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,330 bytes
コンパイル時間 1,346 ms
コンパイル使用メモリ 145,160 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 08:30:34
合計ジャッジ時間 4,309 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,376 KB
testcase_43 AC 1 ms
4,380 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,376 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,376 KB
testcase_51 AC 2 ms
4,380 KB
testcase_52 AC 2 ms
4,376 KB
testcase_53 AC 1 ms
4,380 KB
testcase_54 AC 1 ms
4,380 KB
testcase_55 AC 2 ms
4,376 KB
testcase_56 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:26:18: warning: ‘by’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int ax, ay, bx, by;
                  ^~
main.cpp:26:14: warning: ‘bx’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  int ax, ay, bx, by;
              ^~
main.cpp:39:21: warning: ‘ay’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  dx1 = ax - bx; dy1 = ay - by;  dz1 = 0;
                 ~~~~^~~~~~~~~
main.cpp:39:6: warning: ‘ax’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  dx1 = ax - bx; dy1 = ay - by;  dz1 = 0;
  ~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;

string s[110];
int h, w;

int main(void){
	cin >> h >> w;
	rep(i, h) cin >> s[i];
	int ax, ay, bx, by;
	int cnt = 0;
	rep(i, h)rep(j, w){
		if(s[i][j] == '*'){
			if(cnt == 0){
				ax = j, ay = i;
			}else{
				bx = j, by = i;
			}
			cnt++;
		}
	}
	int dx1, dx2, dy1, dy2, dz1, dz2;
	dx1 = ax - bx; dy1 = ay - by;  dz1 = 0;
	// printf("%d %d %d\n", dx1, dy1, dz1);
	rep(i, h)rep(j, w){
		if(s[i][j] == '*') continue;
		dx2 = j - bx; dy2 = i - by; dz2 = 0;
		// printf("%d %d %d\n", dx2, dy2, dz2);
		int ret = (dy1 * dz2 - dy2 * dz1) + (dx1 * dz2 - dx2 * dz1) + (dx1 * dy2 - dx2 * dy1);
		// printf("ret %d %d %d\n", ret, i, j);
		if(ret != 0){
			s[i][j] = '*';
			rep(k, h){
				cout << s[k] << endl;
			}
			return 0;
		}
	}
	printf("no\n");
	return 0;
}
0