結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2017-03-27 23:09:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,209 bytes |
コンパイル時間 | 1,598 ms |
コンパイル使用メモリ | 171,948 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 00:59:34 |
合計ジャッジ時間 | 3,553 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
コンパイルメッセージ
main.cpp: In function 'void solve()': main.cpp:45:9: warning: 'ny' may be used uninitialized [-Wmaybe-uninitialized] 45 | vec[ny][nx] = '*'; | ^ main.cpp:24:10: note: 'ny' was declared here 24 | int nx,ny; | ^~ main.cpp:45:13: warning: 'nx' may be used uninitialized [-Wmaybe-uninitialized] 45 | vec[ny][nx] = '*'; | ^ main.cpp:24:7: note: 'nx' was declared here 24 | int nx,ny; | ^~
ソースコード
#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;}