結果

問題 No.455 冬の大三角
ユーザー face4
提出日時 2018-05-21 22:07:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 962 bytes
コンパイル時間 587 ms
コンパイル使用メモリ 70,712 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 07:09:56
合計ジャッジ時間 2,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    char sky[h][w];
    vector<pair<int,int>> pos;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> sky[i][j];
            if(sky[i][j] == '*')    pos.push_back({i,j});
        }
    }

    pair<int,int> p1 = pos[0];
    pair<int,int> p2 = pos[1];
    
    if(p1.first == p2.first){
        for(int i = 0; i < h; i++){
            if(i != p1.first){
                sky[i][p1.second] = '*';
                break;
            }
        }
    }else{
        for(int i = 0; i < w; i++){
            if(i != p1.second){
                sky[p1.first][i] = '*';
                break;
                cout << p1.first << " : " << i << endl;
            }
        }
    }

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

    return 0;
}
0