結果
| 問題 |
No.455 冬の大三角
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-15 11:51:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 626 bytes |
| コンパイル時間 | 625 ms |
| コンパイル使用メモリ | 72,960 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 23:46:16 |
| 合計ジャッジ時間 | 2,300 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 54 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <utility>
using namespace std;
typedef pair<int, int> PII;
int main() {
int h, w;
cin >> h >> w;
vector<string> sky(h);
vector<PII> star;
for (int i = 0; i < h; i++) {
cin >> sky[i];
for (int j = 0; j < w; j++) {
if (sky[i][j] == '*') {
star.emplace_back(make_pair(i, j));
}
}
}
int a = star[0].first;
int b = star[1].second;
if (star[0].first == star[1].first) {
a = (a + 1) % h;
} else if (star[0].second == star[1].second) {
b = (b + 1) % w;
}
sky[a][b] = '*';
for (auto s : sky) {
cout << s << endl;
}
return 0;
}